]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
USB: usbfs: Don't WARN about excessively large memory allocations
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 18 May 2021 20:18:35 +0000 (16:18 -0400)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 15 Jul 2021 17:22:31 +0000 (19:22 +0200)
commite0106ea5aefbaa15f10e884885264927a2ac4c64
tree21dbaa0b4fa640f58daa4434a69fe9c3e9f226a4
parent7b2cb03424d956a4d2343dc4a5b11afe6f95ccc5
USB: usbfs: Don't WARN about excessively large memory allocations

BugLink: https://bugs.launchpad.net/bugs/1931896
commit 4f2629ea67e7225c3fd292c7fe4f5b3c9d6392de 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: syzbot+882a85c0c8ec4a3e2281@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20210518201835.GA1140918@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/usb/core/devio.c