All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] _scsih_sas_host_add early exits can crash system
@ 2016-05-25 19:14 Joe Lawrence
  2016-05-25 19:14 ` [PATCH 1/2] mpt3sas - set num_phys after allocating phy[] space Joe Lawrence
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joe Lawrence @ 2016-05-25 19:14 UTC (permalink / raw)
  To: linux-scsi
  Cc: sathya.prakash, chaitra.basappa, suganath-prabu.subramani, Joe Lawrence

There are many error paths in _scsih_sas_host_add that lead to an early
exit and a few that leave IOC resources uninitialized, setting the stage
for a later crash.

This can be emulated using a systemtap script like:

  % stap -g -e \
  'probe module("mpt3sas").function("mpt3sas_config_get_sas_iounit_pg0").return { $return = -1 }'

to force early exit, while remove/re-adding an MPT3 adapter:

  % lspci -D | grep MPT
  0000:54:00.0 Mass storage controller: LSI Logic / Symbios Logic SAS3008 PCI-Express Fusion-MPT SAS-3 (rev 02)

  % SYSFS=$(find /sys/devices -name 0000:54:00.0)
  % SYSFS_PARENT=$(dirname $SYSFS)

  % echo 1 > $SYSFS/remove
  % sleep 1m
  % echo 1 > $SYSFS_PARENT/rescan

These two patches fix:
  1) referencing unallocated ioc->sas_hba.phy[] space
  2) passing a NULL ioc->sas_hba.parent_dev to the scsi_transport_sas
     layer.

Note: these changes don't improve or retry adapter initialization, but
      only try to prevent the system from crashing

Joe Lawrence (2):
  mpt3sas - set num_phys after allocating phy[] space
  mpt3sas - avoid mpt3sas_transport_port_add NULL parent_dev

 drivers/scsi/mpt3sas/mpt3sas_scsih.c     | 20 +++++++++++---------
 drivers/scsi/mpt3sas/mpt3sas_transport.c |  5 +++++
 2 files changed, 16 insertions(+), 9 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-01  2:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 19:14 [PATCH 0/2] _scsih_sas_host_add early exits can crash system Joe Lawrence
2016-05-25 19:14 ` [PATCH 1/2] mpt3sas - set num_phys after allocating phy[] space Joe Lawrence
2016-05-27  8:18   ` Sreekanth Reddy
2016-05-25 19:14 ` [PATCH 2/2] mpt3sas - avoid mpt3sas_transport_port_add NULL parent_dev Joe Lawrence
2016-05-27  8:18   ` Sreekanth Reddy
2016-06-01  2:41 ` [PATCH 0/2] _scsih_sas_host_add early exits can crash system Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.