Skip to content

Commit 536d2a6

Browse files
oneukumgregkh
authored andcommitted
usbnet: fix memory allocation in helpers
commit e65af54 upstream. 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 <oneukum@suse.com> Link: https://lore.kernel.org/r/20220628093517.7469-1-oneukum@suse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f7eaa22 commit 536d2a6

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
@@ -2002,7 +2002,7 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
20022002
cmd, reqtype, value, index, size);
20032003

20042004
if (size) {
2005-
buf = kmalloc(size, GFP_KERNEL);
2005+
buf = kmalloc(size, GFP_NOIO);
20062006
if (!buf)
20072007
goto out;
20082008
}
@@ -2034,7 +2034,7 @@ static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
20342034
cmd, reqtype, value, index, size);
20352035

20362036
if (data) {
2037-
buf = kmemdup(data, size, GFP_KERNEL);
2037+
buf = kmemdup(data, size, GFP_NOIO);
20382038
if (!buf)
20392039
goto out;
20402040
} else {

0 commit comments

Comments
 (0)