USB: gadget: validate interface OS descriptor requests
authorSzymon Heidrich <szymon.heidrich@gmail.com>
Mon, 24 Jan 2022 11:14:00 +0000 (12:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Feb 2022 11:56:35 +0000 (12:56 +0100)
commit3e33e5c67cb9ebd2b791b9a9fb2b71daacebd8d4
tree3b45c5814f0d1cac6bbbc017d1ffc6b1347c7d10
parentd3d5bfb3a279eaa4f344cb7554b0603641a4ae34
USB: gadget: validate interface OS descriptor requests

commit 75e5b4849b81e19e9efe1654b30d7f3151c33c2c upstream.

Stall the control endpoint in case provided index exceeds array size of
MAX_CONFIG_INTERFACES or when the retrieved function pointer is null.

Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/composite.c