Re: [PATCH] usb/core/devio.c: Don't use GFP_KERNEL while we cannot reset a storage device

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

 



On Mon, 11 Mar 2013, Ming Lei wrote:

> On Mon, Mar 11, 2013 at 11:32 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Of course you have to lock the device before changing its driver.  What
> > would happen if two different threads tried to change a device's driver
> > at the same time?
> 
> Yes, claim/release interface need device lock, but the patch doesn't
> touch claim/release command handling.

Then why did you ask?  You wrote: "Looks device lock isn't required for
USB transfer of kernel driver."


> > usbdev_do_ioctl() needs to acquire the device lock in order to prevent
> > races with driver_disconnect() and usbdev_remove().
> 
> Looks the patch basically converts the allocation inside URB submit path,
> and actually I mean why we need to hold device lock in submitting
> URB path?  Device lock isn't required before submitting URBs
> in kernel driver.

In general it isn't, no.  But usbfs uses the lock to prevent races with 
driver_disconnect() -- it is invalid to submit URBs after the 
disconnect routine has returned.

Alan Stern

--
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