aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorching Huang <[email protected]>2020-10-27 11:39:13 +0800
committerMartin K. Petersen <[email protected]>2020-10-29 22:10:34 -0400
commiteb3b956d2c9bfd86ca38ea5ce6343efcbacff641 (patch)
treefa9c235c7ebcbaed036bba72849acc5f1c568758
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/[email protected] Signed-off-by: ching Huang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
-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);