scsi: ibmvscsi: Protect ibmvscsi_head from concurrent modificaiton
commitbc1bf16d7defec622e3d9a13b841d079e73063eb
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Wed, 20 Mar 2019 18:41:50 +0000 (20 13:41 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 05:17:54 +0000 (27 14:17 +0900)
tree14bcd2750243e07bd1dc09611e4e4518b40d1802
parente109bf21f4c61a869237a107249687d3c0f7e9ea
scsi: ibmvscsi: Protect ibmvscsi_head from concurrent modificaiton

commit 7205981e045e752ccf96cf6ddd703a98c59d4339 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/ibmvscsi/ibmvscsi.c