summaryrefslogtreecommitdiff
path: root/drivers/scsi/arcmsr
diff options
context:
space:
mode:
authorching Huang <ching2048@areca.com.tw>2020-10-27 11:39:13 +0800
committerMartin K. Petersen <martin.petersen@oracle.com>2020-10-29 22:10:34 -0400
commiteb3b956d2c9bfd86ca38ea5ce6343efcbacff641 (patch)
treefa9c235c7ebcbaed036bba72849acc5f1c568758 /drivers/scsi/arcmsr
parent4f1826b8e56ffb5c0b7243a7b573bb521b919dfb (diff)
scsi: arcmsr: Ensure getting a free ccb is done under the spin_lock
Ensure getting a free ccb is done under the spin_lock. Link: https://lore.kernel.org/r/f3ec374cada762149911ff35e92a68a15a7d0327.camel@areca.com.tw Signed-off-by: ching Huang <ching2048@areca.com.tw> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/arcmsr')
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 7cfae1decd12..127fe50e6b12 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -3162,10 +3162,12 @@ message_out:
static struct CommandControlBlock *arcmsr_get_freeccb(struct AdapterControlBlock *acb)
{
- struct list_head *head = &acb->ccb_free_list;
+ struct list_head *head;
struct CommandControlBlock *ccb = NULL;
unsigned long flags;
+
spin_lock_irqsave(&acb->ccblist_lock, flags);
+ head = &acb->ccb_free_list;
if (!list_empty(head)) {
ccb = list_entry(head->next, struct CommandControlBlock, list);
list_del_init(&ccb->list);