kernel_samsung_a53x/drivers/usb/storage
Alan Stern b41950d1d9 USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command
commit 014bcf41d946b36a8f0b8e9b5d9529efbb822f49 upstream.

The isd200 sub-driver in usb-storage uses the HEADS and SECTORS values
in the ATA ID information to calculate cylinder and head values when
creating a CDB for READ or WRITE commands.  The calculation involves
division and modulus operations, which will cause a crash if either of
these values is 0.  While this never happens with a genuine device, it
could happen with a flawed or subversive emulation, as reported by the
syzbot fuzzer.

Protect against this possibility by refusing to bind to the device if
either the ATA_ID_HEADS or ATA_ID_SECTORS value in the device's ID
information is 0.  This requires isd200_Initialization() to return a
negative error code when initialization fails; currently it always
returns 0 (even when there is an error).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+28748250ab47a8f04100@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-usb/0000000000003eb868061245ba7f@google.com/
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Reviewed-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/b1e605ea-333f-4ac0-9511-da04f411763e@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-19 09:22:39 +01:00
..
alauda.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cypress_atacb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
datafab.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ene_ub6250.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
freecom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
initializers.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
initializers.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isd200.c USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command 2024-11-19 09:22:39 +01:00
jumpshot.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
karma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
onetouch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
option_ms.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
option_ms.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
protocol.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
protocol.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
realtek_cr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scsiglue.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scsiglue.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sddr09.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sddr55.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
shuttle_usbat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sierra_ms.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sierra_ms.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transport.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transport.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uas-detect.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uas.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_alauda.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_cypress.h usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility 2024-11-18 10:58:47 +01:00
unusual_datafab.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_devs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_ene_ub6250.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_freecom.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_isd200.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_jumpshot.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_karma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_onetouch.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_realtek.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_sddr09.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_sddr55.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_uas.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unusual_usbat.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usual-tables.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00