All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@stratus.com>
To: linux-scsi@vger.kernel.org
Cc: sathya.prakash@broadcom.com, chaitra.basappa@broadcom.com,
	suganath-prabu.subramani@broadcom.com,
	Joe Lawrence <joe.lawrence@stratus.com>
Subject: [PATCH 0/2] _scsih_sas_host_add early exits can crash system
Date: Wed, 25 May 2016 15:14:27 -0400	[thread overview]
Message-ID: <1464203669-31974-1-git-send-email-joe.lawrence@stratus.com> (raw)

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


             reply	other threads:[~2016-05-25 19:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 19:14 Joe Lawrence [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464203669-31974-1-git-send-email-joe.lawrence@stratus.com \
    --to=joe.lawrence@stratus.com \
    --cc=chaitra.basappa@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sathya.prakash@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.