alistair23-linux/drivers/usb/storage
Alan Stern 786de92b3c USB: uas: fix bug in handling of alternate settings
The uas driver has a subtle bug in the way it handles alternate
settings.  The uas_find_uas_alt_setting() routine returns an
altsetting value (the bAlternateSetting number in the descriptor), but
uas_use_uas_driver() then treats that value as an index to the
intf->altsetting array, which it isn't.

Normally this doesn't cause any problems because the various
alternate settings have bAlternateSetting values 0, 1, 2, ..., so the
value is equal to the index in the array.  But this is not guaranteed,
and Andrey Konovalov used the syzkaller fuzzer with KASAN to get a
slab-out-of-bounds error by violating this assumption.

This patch fixes the bug by making uas_find_uas_alt_setting() return a
pointer to the altsetting entry rather than either the value or the
index.  Pointers are less subject to misinterpretation.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
CC: Oliver Neukum <oneukum@suse.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-22 18:29:00 +02:00
..
alauda.c usb: storage: alauda: don't print on ENOMEM 2016-08-30 19:17:39 +02:00
cypress_atacb.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
datafab.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
debug.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
debug.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
ene_ub6250.c Merge 4.12-rc2 into usb-next 2017-05-22 09:00:23 +02:00
freecom.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
initializers.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
initializers.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
isd200.c usb: storage: return on error to avoid a null pointer dereference 2017-07-17 13:11:57 +02:00
jumpshot.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
karma.c usb: storage: karma: remove useless variable 2017-03-17 13:27:41 +09:00
Kconfig PM / Kconfig: Replace PM_RUNTIME with PM in dependencies 2014-12-13 00:44:04 +01:00
Makefile usb: remove libusual 2012-09-05 17:21:36 -07:00
onetouch.c usb: storage: fix module reference for scsi host 2015-05-10 16:03:50 +02:00
option_ms.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
option_ms.h
protocol.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
protocol.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
realtek_cr.c USB: realtek_cr: remove unneeded MODULE_VERSION() usage 2017-07-22 15:56:53 +02:00
scsiglue.c scsi: introduce a quirk for false cache reporting 2016-09-13 08:08:24 +02:00
scsiglue.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
sddr09.c usb: storage: sddr09: Remove a set-but-not-used variable 2017-01-25 10:52:43 +01:00
sddr55.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
shuttle_usbat.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
sierra_ms.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
sierra_ms.h
transport.c usb-storage: fix bogus hardware error messages for ATA pass-thru devices 2017-09-22 10:08:50 +02:00
transport.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
uas-detect.h USB: uas: fix bug in handling of alternate settings 2017-09-22 18:29:00 +02:00
uas.c USB: uas: fix bug in handling of alternate settings 2017-09-22 18:29:00 +02:00
unusual_alauda.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_cypress.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_datafab.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_devs.h usb-storage: unusual_devs entry to fix write-access regression for Seagate external drives 2017-09-22 10:08:50 +02:00
unusual_ene_ub6250.h
unusual_freecom.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_isd200.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_jumpshot.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_karma.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_onetouch.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_realtek.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_sddr09.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_sddr55.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
unusual_uas.h uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069 2017-07-30 07:18:27 -07:00
unusual_usbat.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
usb.c usb-storage: fix deadlock involving host lock and scsi_done 2017-07-30 07:18:27 -07:00
usb.h usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00
usual-tables.c usb: storage: fix multi-line comment style 2016-04-26 15:04:38 -07:00