]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mpt3sas: Refcount sas_device objects and fix unsafe list usage
authorSreekanth Reddy <sreekanth.reddy@avagotech.com>
Wed, 11 Nov 2015 12:00:30 +0000 (17:30 +0530)
committerChuck Anderson <chuck.anderson@oracle.com>
Wed, 13 Jul 2016 07:33:11 +0000 (00:33 -0700)
commit990775ceaf9bcc3537c7720cd4e8b89a0be2594b
tree7c4f5077c0166203deccf3e789cce75b0dc7fed5
parente7a5a9b48d22505517e288b84eb142d3cfba6b93
mpt3sas: Refcount sas_device objects and fix unsafe list usage

sas_device objects can be referenced concurrently throughout the driver.
We need a way to make sure threads can't delete them out from under each
other. This patch adds the refcount and refactors the code to use it.

Additionally, we cannot iterate over the sas_device_list without holding
the lock or we risk corrupting random memory if items are added or
deleted as we iterate. This patch refactors _scsih_probe_sas() to use
the sas_device_list in a safe way.

This patch is ported from the following mpt2sas driver commit
d224fe0d6097 ("mpt2sas: Refcount sas_device objects and fix unsafe list
usage").

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 22529571
(cherry picked from commit d1cb5e495e5384f6d90a8573f1be9cc79b85c862)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.h
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/scsi/mpt3sas/mpt3sas_transport.c