USB: gadget: validate interface OS descriptor requests
commit 75e5b4849b
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1187fc20f4
commit
f3bcd744b0
@ -1932,6 +1932,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;
|
||||||
if (w_length == 0x0A) {
|
if (w_length == 0x0A) {
|
||||||
count = count_ext_prop(os_desc_cfg,
|
count = count_ext_prop(os_desc_cfg,
|
||||||
|
Reference in New Issue
Block a user