UPSTREAM: USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor()
commit 1c0edc3633b56000e18d82fc241e3995ca18a69e Andrey used the syzkaller fuzzer to find an out-of-bounds memory access in usb_get_bos_descriptor(). The code wasn't checking that the next usb_dev_cap_header structure could fit into the remaining buffer space. This patch fixes the error and also reduces the bNumDeviceCaps field in the header to match the actual number of capabilities found, in cases where there are fewer than expected. Bug: 69052675 Change-Id: Ica990541695ce5ba46ca8d2bd01e8230dcf5dcd4 Reported-by:Andrey Konovalov <andreyknvl@google.com> Signed-off-by:
Alan Stern <stern@rowland.harvard.edu> Tested-by:
Andrey Konovalov <andreyknvl@google.com> CC: <stable@vger.kernel.org> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading
Please register or sign in to comment