Feature #3220
open077: NOIO allocation under usb_lock
0%
Description
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](http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=acbe2febe71abb2360b008e9ab3ee5c44169f78c)
EXAMPLE
The following drivers contain this error (in version 2.6.32):
- `drivers/usb/core/devices.c`
- `drivers/usb/core/message.c`
Updated by Ilya Shchepetkov over 12 years ago
- Subject changed from 077: NOIO allocation under usb_lock to 77_1: NOIO allocation under usb_lock
- Status changed from New to Resolved
Completely redesigned model you can see in the commit 8f6d4d2 of 77_1a branch.
Updated by Evgeny Novikov almost 12 years ago
- Status changed from Resolved to Open
Please, use ability to refer to function argument by its name specified in aspect file (implemented in #3802).
Updated by Ilya Shchepetkov almost 12 years ago
- Status changed from Open to Resolved
The ability to refer to function argument by its name specified in aspect file was added in the commit b4b7331 of master branch.
Tests passed.
Updated by Alexey Khoroshilov over 11 years ago
- Subject changed from 77_1: NOIO allocation under usb_lock to 077_1: NOIO allocation under usb_lock
- Description updated (diff)
Updated by Vadim Mutilin about 11 years ago
- Subject changed from 077_1: NOIO allocation under usb_lock to 077: NOIO allocation under usb_lock
Updated by Vitaly Mordan about 10 years ago
Some functions in "before: ALLOC", "around: ALLOC_AROUND" and "before: ALLOC_WITHOUT" (for example, static inline void *kmalloc(.., gfp_t flags, ..) and static inline void *kzalloc(.., gfp_t flags, ..)) will always return 0, which makes some pathes in program infeasible.
Updated by Evgeny Novikov about 10 years ago
- Status changed from Resolved to Open
- Assignee changed from Ilya Shchepetkov to Vitaly Mordan