]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
USB: gadget: detect too-big endpoint 0 requests
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Dec 2021 17:59:27 +0000 (18:59 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:19 +0000 (09:49 +0100)
commit0903041db8c83e453fb86216400918158a12592c
tree5b25c3a3d720a6de350c70b7f3d272dd9c835202
parent25c664a28f1defa450e93addb7736cb970042eb1
USB: gadget: detect too-big endpoint 0 requests

BugLink: https://bugs.launchpad.net/bugs/1954931
commit 153a2d7e3350cc89d406ba2d35be8793a64c2038 upstream.

Sometimes USB hosts can ask for buffers that are too large from endpoint
0, which should not be allowed.  If this happens for OUT requests, stall
the endpoint, but for IN requests, trim the request size to the endpoint
buffer size.

Co-developed-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/usb/gadget/composite.c
drivers/usb/gadget/legacy/dbgp.c
drivers/usb/gadget/legacy/inode.c