linux/drivers/message/fusion
Helge Deller 2f4843b172 scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove()
The mptscsih_remove() function triggers a kernel oops if the Scsi_Host
pointer (ioc->sh) is NULL, as can be seen in this syslog:

 ioc0: LSI53C1030 B2: Capabilities={Initiator,Target}
 Begin: Waiting for root file system ...
 scsi host2: error handler thread failed to spawn, error = -4
 mptspi: ioc0: WARNING - Unable to register controller with SCSI subsystem
 Backtrace:
  [<000000001045b7cc>] mptspi_probe+0x248/0x3d0 [mptspi]
  [<0000000040946470>] pci_device_probe+0x1ac/0x2d8
  [<0000000040add668>] really_probe+0x1bc/0x988
  [<0000000040ade704>] driver_probe_device+0x160/0x218
  [<0000000040adee24>] device_driver_attach+0x160/0x188
  [<0000000040adef90>] __driver_attach+0x144/0x320
  [<0000000040ad7c78>] bus_for_each_dev+0xd4/0x158
  [<0000000040adc138>] driver_attach+0x4c/0x80
  [<0000000040adb3ec>] bus_add_driver+0x3e0/0x498
  [<0000000040ae0130>] driver_register+0xf4/0x298
  [<00000000409450c4>] __pci_register_driver+0x78/0xa8
  [<000000000007d248>] mptspi_init+0x18c/0x1c4 [mptspi]

This patch adds the necessary NULL-pointer checks.  Successfully tested on
a HP C8000 parisc workstation with buggy SCSI drives.

Link: https://lore.kernel.org/r/20201022090005.GA9000@ls3530.fritz.box
Cc: <stable@vger.kernel.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-10-26 16:57:18 -04:00
..
lsi scsi: message: fusion: fix a few trivial spelling mistakes 2018-09-11 21:18:06 -04:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mptbase.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
mptbase.h fusion: remove dead MTRR code 2015-06-13 08:44:14 -07:00
mptctl.c scsi: mptctl: Remove unneeded cast from memory allocation 2020-08-20 23:17:35 -04:00
mptctl.h
mptdebug.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mptfc.c scsi: mptfc: Remove unneeded cast from memory allocation 2020-08-20 23:15:19 -04:00
mptlan.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
mptlan.h scsi: fusion: fix if-statement empty body warning 2020-03-11 23:07:57 -04:00
mptsas.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
mptsas.h scsi: message: fusion: Replace zero-length array with flexible-array member 2020-03-26 22:40:47 -04:00
mptscsih.c scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() 2020-10-26 16:57:18 -04:00
mptscsih.h scsi: drop reason argument from ->change_queue_depth 2014-11-24 14:45:27 +01:00
mptspi.c scsi: mptfusion: remove set, but not used, variables 2019-03-19 17:19:36 -04:00