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
2004 cmd, reqtype, value, index, size);2004 cmd, reqtype, value, index, size);
2005 2005
2006 if (size) {2006 if (size) {
2007 buf = kmalloc(size, GFP_KERNEL);2007 buf = kmalloc(size, GFP_NOIO);
2008 if (!buf)2008 if (!buf)
2009 goto out;2009 goto out;
2010 }2010 }
@@ -2036,7 +2036,7 @@ static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, · 25 unmodified lines
2036 cmd, reqtype, value, index, size);2036 cmd, reqtype, value, index, size);
2037 2037
2038 if (data) {2038 if (data) {
2039 buf = kmemdup(data, size, GFP_KERNEL);2039 buf = kmemdup(data, size, GFP_NOIO);
2040 if (!buf)2040 if (!buf)
2041 goto out;2041 goto out;
2042 } else {2042 } else {