scsi: ibmvscsi: Protect ibmvscsi_head from concurrent modificaiton
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Wed, 20 Mar 2019 18:41:50 +0000 (13:41 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Mar 2019 00:12:31 +0000 (20:12 -0400)
commit7205981e045e752ccf96cf6ddd703a98c59d4339
treefbb3c6318cf5d52373ba401355446e076d1ac350
parent0e83fc61eee62979260f6aeadd23ee8b615ee1a2
scsi: ibmvscsi: Protect ibmvscsi_head from concurrent modificaiton

For each ibmvscsi host created during a probe or destroyed during a remove
we either add or remove that host to/from the global ibmvscsi_head
list. This runs the risk of concurrent modification.

This patch adds a simple spinlock around the list modification calls to
prevent concurrent updates as is done similarly in the ibmvfc driver and
ipr driver.

Fixes: 32d6e4b6e4ea ("scsi: ibmvscsi: add vscsi hosts to global list_head")
Cc: <stable@vger.kernel.org> # v4.10+
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ibmvscsi/ibmvscsi.c