]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
USB: gadget: bRequestType is a bitfield, not a enum
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Dec 2021 18:46:21 +0000 (19:46 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:27 +0000 (09:49 +0100)
commitbb272794d2700df536003620fb17f5a13e9a2f4a
treead36e5524978c0768f13f6601882a6f37b64986d
parentf46c2c63a0daaeadcc8e602418963f15d12d390f
USB: gadget: bRequestType is a bitfield, not a enum

BugLink: https://bugs.launchpad.net/bugs/1956302
[ Upstream commit f08adf5add9a071160c68bb2a61d697f39ab0758 ]

Szymon rightly pointed out that the previous check for the endpoint
direction in bRequestType was not looking at only the bit involved, but
rather the whole value.  Normally this is ok, but for some request
types, bits other than bit 8 could be set and the check for the endpoint
length could not stall correctly.

Fix that up by only checking the single bit.

Fixes: 153a2d7e3350 ("USB: gadget: detect too-big endpoint 0 requests")
Cc: Felipe Balbi <balbi@kernel.org>
Reported-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Link: https://lore.kernel.org/r/20211214184621.385828-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/usb/gadget/composite.c
drivers/usb/gadget/legacy/dbgp.c
drivers/usb/gadget/legacy/inode.c