scsi: hisi_sas: lock sensitive regions when servicing CQ interrupt
authorJohn Garry <john.garry@huawei.com>
Tue, 3 Jan 2017 12:24:49 +0000 (20:24 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 5 Jan 2017 23:24:11 +0000 (18:24 -0500)
commit64d63187325884b96f684f1d839ec5d5ce231b92
treecb391c6ce6582bf4d8e7d45f0c00e4c0767b7209
parentd177c408113e5d8b664b2ae34e5cd7b27c686a12
scsi: hisi_sas: lock sensitive regions when servicing CQ interrupt

There is a bug in the current driver in that certain hisi_hba and port
structure elements which we access when servicing the CQ interrupt do
not use thread-safe accesses; these include hisi_sas_port linked-list of
active slots (hisi_sas_port.entry), bitmap of currently allocated IPTT
(in hisi_hba.slot_index_tags), and completion queue read pointer.

As a solution, lock these elements with the hisi_hba.lock.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c