Skip to content

Commit e65af54

Browse files
oneukumkuba-moo
authored andcommitted
usbnet: fix memory allocation in helpers
usbnet provides some helper functions that are also used in the context of reset() operations. During a reset the other drivers on a device are unable to operate. As that can be block drivers, a driver for another interface cannot use paging in its memory allocations without risking a deadlock. Use GFP_NOIO in the helpers. Fixes: 877bd86 ("usbnet: introduce usbnet 3 command helpers") Signed-off-by: Oliver Neukum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7b92aa9 commit e65af54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/usb/usbnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,7 +2004,7 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
20042004
cmd, reqtype, value, index, size);
20052005

20062006
if (size) {
2007-
buf = kmalloc(size, GFP_KERNEL);
2007+
buf = kmalloc(size, GFP_NOIO);
20082008
if (!buf)
20092009
goto out;
20102010
}
@@ -2036,7 +2036,7 @@ static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
20362036
cmd, reqtype, value, index, size);
20372037

20382038
if (data) {
2039-
buf = kmemdup(data, size, GFP_KERNEL);
2039+
buf = kmemdup(data, size, GFP_NOIO);
20402040
if (!buf)
20412041
goto out;
20422042
} else {

0 commit comments

Comments
 (0)