]> git.baikalelectronics.ru Git - 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Dec 2021 09:57:19 +0000 (10:57 +0100)
commit5ebb08c71162bd1893ee5b4b7eee54e57fbb3ef0
treeb34645895d454d4499dce2d350c537e2fb459202
parentb9432c5bc92c1a084c1aa34c04d8becd1f85856b
USB: gadget: detect too-big endpoint 0 requests

commit 0c907a0f276e9ee57d30e14a7335d413eee7d7ac 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>
drivers/usb/gadget/composite.c
drivers/usb/gadget/legacy/dbgp.c
drivers/usb/gadget/legacy/inode.c