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

CVE-2024-27059

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: 1da177e4c3 ("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>
Signed-off-by: Huang Cun <cunhuang@tencent.com>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
2024-11-28 14:55:52 +08:00
..
Kconfig USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
Makefile ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
alauda.c tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
cypress_atacb.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
datafab.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
debug.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
debug.h usb-storage: remove single-use define for debugging 2019-09-10 10:30:53 +02:00
ene_ub6250.c tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
freecom.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
initializers.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
initializers.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
isd200.c USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command 2024-11-28 14:55:52 +08:00
jumpshot.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
karma.c tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
onetouch.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
option_ms.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
option_ms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
protocol.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
protocol.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
realtek_cr.c tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
scsiglue.c tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
scsiglue.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
sddr09.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
sddr55.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
shuttle_usbat.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
sierra_ms.c usb: sierra: fix a missing check of device_create_file 2019-03-26 16:42:52 +09:00
sierra_ms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
transport.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
transport.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
uas-detect.h tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
uas.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
unusual_alauda.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_cypress.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_datafab.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_devs.h tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
unusual_ene_ub6250.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_freecom.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_isd200.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_jumpshot.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_karma.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_onetouch.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_realtek.h USB: usb-storage: Add new ID to ums-realtek 2019-06-05 11:52:42 +02:00
unusual_sddr09.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_sddr55.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_uas.h tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
unusual_usbat.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
usb.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
usb.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
usual-tables.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00