UPSTREAM: USB: gadget: validate interface OS descriptor requests
Stall the control endpoint in case provided index exceeds array size of
MAX_CONFIG_INTERFACES or when the retrieved function pointer is null.
Bug: 213172319
Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 75e5b4849b)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I78f46b6f2140394a6bc6cff9f829c0742d7ad2fc
This commit is contained in:
committed by
Todd Kjos
parent
6f915dd2af
commit
c7732dbce5
@@ -1975,6 +1975,9 @@ unknown:
|
|||||||
if (w_index != 0x5 || (w_value >> 8))
|
if (w_index != 0x5 || (w_value >> 8))
|
||||||
break;
|
break;
|
||||||
interface = w_value & 0xFF;
|
interface = w_value & 0xFF;
|
||||||
|
if (interface >= MAX_CONFIG_INTERFACES ||
|
||||||
|
!os_desc_cfg->interface[interface])
|
||||||
|
break;
|
||||||
buf[6] = w_index;
|
buf[6] = w_index;
|
||||||
count = count_ext_prop(os_desc_cfg,
|
count = count_ext_prop(os_desc_cfg,
|
||||||
interface);
|
interface);
|
||||||
|
|||||||
Reference in New Issue
Block a user