Online Linux Driver Verification Service (alpha)

0077

RULE_ERROR

Not disabling IO during memory allocation while holding a USB device lock

Summary

You should use GFP_NOIO instead of GFP_KERNEL for memory allocations between usb_lock_device() and usb_unlock_device() invocations.

Description

Memory allocations with GFP_KERNEL flag can cause input/output operations to a storage device. These operations can fail thus requiring to reset the device.

Therefore GFP_KERNEL cannot be safely used between usb_lock_device() and usb_unlock_device() incovations. It should be replaced by GFP_NOIO.

Links:

Sample bugfix

Example

The following drivers contain this error (in version 2.6.32):

  • drivers/usb/core/devices.c

  • drivers/usb/core/message.c