]> www.infradead.org Git - users/dwmw2/linux.git/commit
USB: w1 ds2490: Fix bug caused by improper use of altsetting array
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 22 Apr 2019 15:16:04 +0000 (11:16 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Aug 2019 11:39:15 +0000 (12:39 +0100)
commitef6b71388a795e0142c23b5c45266d41f8c4cd2b
tree8f4739f4d4d2a9f0d99836a1b328744527e008e2
parent5133454a1f3a7f22412ab083f7ff53f822d50f49
USB: w1 ds2490: Fix bug caused by improper use of altsetting array

commit c114944d7d67f24e71562fcfc18d550ab787e4d4 upstream.

The syzkaller USB fuzzer spotted a slab-out-of-bounds bug in the
ds2490 driver.  This bug is caused by improper use of the altsetting
array in the usb_interface structure (the array's entries are not
always stored in numerical order), combined with a naive assumption
that all interfaces probed by the driver will have the expected number
of altsettings.

The bug can be fixed by replacing references to the possibly
non-existent intf->altsetting[alt] entry with the guaranteed-to-exist
intf->cur_altsetting entry.

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