Commit 1e0bcecb authored by Alan Stern's avatar Alan Stern Committed by Yu Liao
Browse files

USB: usbfs: Don't WARN about excessively large memory allocations

stable inclusion
from stable-v4.19.193
commit 2ab21d6e1411999b5fb43434f421f00bf50002eb
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9BHQL
CVE: CVE-2021-47170

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2ab21d6e1411999b5fb43434f421f00bf50002eb



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

commit 4f2629ea upstream.

Syzbot found that the kernel generates a WARNing if the user tries to
submit a bulk transfer through usbfs with a buffer that is way too
large.  This isn't a bug in the kernel; it's merely an invalid request
from the user and the usbfs code does handle it correctly.

In theory the same thing can happen with async transfers, or with the
packet descriptor table for isochronous transfers.

To prevent the MM subsystem from complaining about these bad
allocation requests, add the __GFP_NOWARN flag to the kmalloc calls
for these buffers.

CC: Andrew Morton <akpm@linux-foundation.org>
CC: <stable@vger.kernel.org>
Reported-and-tested-by: default avatar <syzbot+882a85c0c8ec4a3e2281@syzkaller.appspotmail.com>
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20210518201835.GA1140918@rowland.harvard.edu


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYu Liao <liaoyu15@huawei.com>
parent 6726609c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment