]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: hisi_sas: lock sensitive region in hisi_sas_slot_abort()
authorJohn Garry <john.garry@huawei.com>
Tue, 3 Jan 2017 12:24:50 +0000 (20:24 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 5 Jan 2017 23:24:11 +0000 (18:24 -0500)
When we call hisi_sas_slot_task_free() we should grab the hisi_hba.lock,
as hisi_sas_slot_task_free() accesses common hisi_hba elements.
Function hisi_sas_slot_abort() is missing this, so add it.

Signed-off-by: John Garry <john.garry@huawei.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_main.c

index d50e9cfefd240fb962b10b1a764af910ab94e791..22dba0143bdc8a6ab84cacebbf22d0313a8b1d38 100644 (file)
@@ -146,6 +146,7 @@ static void hisi_sas_slot_abort(struct work_struct *work)
        struct scsi_lun lun;
        struct device *dev = &hisi_hba->pdev->dev;
        int tag = abort_slot->idx;
+       unsigned long flags;
 
        if (!(task->task_proto & SAS_PROTOCOL_SSP)) {
                dev_err(dev, "cannot abort slot for non-ssp task\n");
@@ -159,7 +160,9 @@ static void hisi_sas_slot_abort(struct work_struct *work)
        hisi_sas_debug_issue_ssp_tmf(task->dev, lun.scsi_lun, &tmf_task);
 out:
        /* Do cleanup for this task */
+       spin_lock_irqsave(&hisi_hba->lock, flags);
        hisi_sas_slot_task_free(hisi_hba, task, abort_slot);
+       spin_unlock_irqrestore(&hisi_hba->lock, flags);
        if (task->task_done)
                task->task_done(task);
        if (sas_dev)