Skip to content

Commit

Permalink
scsi: arcmsr: Ensure getting a free ccb is done under the spin_lock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ching Huang authored and Martin K. Petersen committed Oct 30, 2020
1 parent 4f1826b commit eb3b956
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/scsi/arcmsr/arcmsr_hba.c
Original file line number Diff line number Diff line change
Expand Up @@ -3162,10 +3162,12 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb,

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);
Expand Down

0 comments on commit eb3b956

Please sign in to comment.