]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
usb: gadget: bdc: validate status-report endpoint indices
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Mon, 23 Mar 2026 12:17:30 +0000 (20:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Mar 2026 14:47:45 +0000 (16:47 +0200)
commita402532ab855620e02a16950aea86fc621c6f87c
tree497cb566c4bab94e73beb4a8a89948e212b372f5
parentd4cdecadbd400a017c3d2a0150fd16d973950e5d
usb: gadget: bdc: validate status-report endpoint indices

bdc_sr_xsf() decodes a 5-bit endpoint number from the hardware status
report and uses it to index bdc->bdc_ep_array[] directly. The array is
only allocated to bdc->num_eps for the current controller instance, so a
status report can carry an endpoint number that still fits the 5-bit
field but does not fit the runtime-sized endpoint table.

Reject status reports whose endpoint number is outside bdc->num_eps
before indexing the endpoint array.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Justin Chen <justin.chen@broadcom.com>
Link: https://patch.msgid.link/20260323121730.75245-1-pengpeng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/bdc/bdc_ep.c