History

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.

Oliver Neukum committed 4 years ago

Commit e65af541 parent 7b92aa91 file · +2 −2Browse files

Unified · Split

drivers/net/usb/usbnet.c+2−2
@@ -2004,7 +2004,7 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, · 2003 unmodified lines
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, · 25 unmodified lines
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 {