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

Alan Stern stern at rowland.harvard.edu
Fri Mar 8 21:55:08 MSK 2013


On Sat, 9 Mar 2013, Alexey Khoroshilov wrote:

> As it was described by Oliver Neukum in commit acbe2fe
> "USB: Don't use GFP_KERNEL while we cannot reset a storage device":
> 
>   Memory allocations with GFP_KERNEL can cause IO to a storage device
>   which can fail resulting in a need to reset the device. Therefore
>   GFP_KERNEL cannot be safely used between usb_lock_device()
>   and usb_unlock_device(). Replace by GFP_NOIO.
> 
> The patch fixes the same issue in usb/core/devio.c.
> All the allocations fixed are under usb_lock_device() from usbdev_do_ioctl().
> 
> Found by Linux Driver Verification project (linuxtesting.org).

I don't know if this is a good idea.  People can and do submit 
transfers requiring a lot of buffer space.  Switching to GFP_NOIO 
will make those allocations a lot more likely to fail.

Oliver, what do you think?

Alan Stern




More information about the ldv-project mailing list