You need to sign in or sign up before continuing.
提交 ac7d1e88 编写于 作者: O Oliver Neukum 提交者: Yongqiang Liu

usbnet: fix memory allocation in helpers

stable inclusion
from stable-4.19.251
commit 6ea9ef0941489b9e720430096594d04513c767fa
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5I4FP
CVE: NA

--------------------------------

commit e65af540 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: 877bd862 ("usbnet: introduce usbnet 3 command helpers")
Signed-off-by: NOliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20220628093517.7469-1-oneukum@suse.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 34bba31e
...@@ -1993,7 +1993,7 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, ...@@ -1993,7 +1993,7 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
cmd, reqtype, value, index, size); cmd, reqtype, value, index, size);
if (size) { if (size) {
buf = kmalloc(size, GFP_KERNEL); buf = kmalloc(size, GFP_NOIO);
if (!buf) if (!buf)
goto out; goto out;
} }
...@@ -2025,7 +2025,7 @@ static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, ...@@ -2025,7 +2025,7 @@ static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
cmd, reqtype, value, index, size); cmd, reqtype, value, index, size);
if (data) { if (data) {
buf = kmemdup(data, size, GFP_KERNEL); buf = kmemdup(data, size, GFP_NOIO);
if (!buf) if (!buf)
goto out; goto out;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册