From: Nicholas Bellinger Date: Wed, 9 Sep 2015 06:05:49 +0000 (-0700) Subject: mpt3sas: Fix unprotected list lookup in v4.3-rc0 changes X-Git-Tag: KARO-TX6UL-2015-11-03~29^2 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=8edb1554f7c2eb73cf70c9856aec01e786b9bcf9 mpt3sas: Fix unprotected list lookup in v4.3-rc0 changes This patch adds the missing mpt3sas_get_sdev_by_addr() protected lookup usage in mpt3sas_transport_port_add() to avoid a NULL pointer dereference when &ioc->sas_device_list or &ioc->sas_device_init_list changes from below without a proper sas_device_get(sas_device) reference held. Also, use the protected mpt3sas_get_sdev_by_handle() lookup within _scsih_block_io_device() as well. Reported-by: Sreekanth Reddy Reported-by: Chaitra Basappa Cc: Calvin Owens Cc: Christoph Hellwig Cc: Martin K. Petersen Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 0431cd0bd948..9e6843275fdf 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2933,7 +2933,7 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) struct scsi_device *sdev; struct _sas_device *sas_device; - sas_device = __mpt3sas_get_sdev_by_handle(ioc, handle); + sas_device = mpt3sas_get_sdev_by_handle(ioc, handle); if (!sas_device) return; diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c index 6074b1137d76..ca36d7ea0964 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c @@ -734,7 +734,7 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, rphy->identify = mpt3sas_port->remote_identify; if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { - sas_device = __mpt3sas_get_sdev_by_addr(ioc, + sas_device = mpt3sas_get_sdev_by_addr(ioc, mpt3sas_port->remote_identify.sas_address); if (!sas_device) { dfailprintk(ioc, printk(MPT3SAS_FMT