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

scsi: arcmsr: Ensure getting a free ccb is done under the spin_lock

parent 4f1826b8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);