]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: Fix slab-out-of-bounds write in usb_get_bos_descriptor
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 13 May 2019 17:14:29 +0000 (13:14 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 5 Oct 2019 15:19:37 +0000 (16:19 +0100)
commit4059812ccce85c3f9cabd1320908357a3c2f549b
tree80753092218b2941528bf75e13477d29d3f05bfb
parent1462cd0da1668beaa1cc4162742c6f6732ed42d8
USB: Fix slab-out-of-bounds write in usb_get_bos_descriptor

commit a03ff54460817c76105f81f3aa8ef655759ccc9a upstream.

The syzkaller USB fuzzer found a slab-out-of-bounds write bug in the
USB core, caused by a failure to check the actual size of a BOS
descriptor.  This patch adds a check to make sure the descriptor is at
least as large as it is supposed to be, so that the code doesn't
inadvertently access memory beyond the end of the allocated region
when assigning to dev->bos->desc->bNumDeviceCaps later on.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+71f1e64501a309fcc012@syzkaller.appspotmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/core/config.c