Commit eb3b956d authored by ching Huang's avatar ching Huang Committed by Martin K. Petersen

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.twSigned-off-by: default avatarching Huang <ching2048@areca.com.tw>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4f1826b8
...@@ -3162,10 +3162,12 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, ...@@ -3162,10 +3162,12 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb,
static struct CommandControlBlock *arcmsr_get_freeccb(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; struct CommandControlBlock *ccb = NULL;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&acb->ccblist_lock, flags); spin_lock_irqsave(&acb->ccblist_lock, flags);
head = &acb->ccb_free_list;
if (!list_empty(head)) { if (!list_empty(head)) {
ccb = list_entry(head->next, struct CommandControlBlock, list); ccb = list_entry(head->next, struct CommandControlBlock, list);
list_del_init(&ccb->list); list_del_init(&ccb->list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment