Re: [PATCH 2/2] usb: no locking for reading descriptors in sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 21, 2016 at 03:18:48PM +0100, Oliver Neukum wrote:
> Quting the relevant thread:
> 
> > In fact, I suspect the locking added by the kernel 3.13 commit for
> > read_descriptors() is invalid because read_descriptors() performs no USB
> > activity; read_descriptors() just reads information from an allocated
> > memory structure. This structure is protected as the structure is
> > existing before and after the sysfs vfs descriptors entry is created or
> > destroyed.
> 
> You're right.  For some reason I thought that usb_deauthorize_device()
> would destroy the rawdescriptor structures (as mentioned in that
> commit's Changelog), but it doesn't.  The locking in read_descriptors()
> is unnecessary.
> 
> > The information is only written at the time of enumeration
> > and does not change. At least that is my understanding.
> >
> > It is noted that in our testing of kernel 3.8 on ARM, that sysfs
> > read_descriptors() was non-blocking because the kernel 3.13 comment was
> > not there.
> >
> > The pre-kernel 3.13 sysfs read_descriptors() seemed to work OK.
> >
> > Proposal:
> > =========
> >
> > Remove the usb_lock_device(udev) and usb_unlock_device(udev) from
> > devices/usb/core/sysfs.c in read_descriptors() that was added by the
> > kernel 3.13 commit
> > "232275a USB: fix substandard locking for the sysfs files"
> >
> > Any comments to this proposal ?
> 
> It seems okay to me.  Please submit a patch.
> 
> So this removes the locking making the point about -EINTR in
> the first path moot.

I don't understand, should I drop this patch?  Should I drop the first
patch?

confused,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux