diff options
author | Matthew Wilcox <matthew@wil.cx> | 2008-02-21 07:44:33 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-02-22 18:15:35 -0500 |
commit | eafe1df9e311034cce204e43c0e45c91723b802f (patch) | |
tree | 6d96be5168ac4aaec4f7c001920dbcf0086cb117 /drivers/scsi/lpfc | |
parent | 65fecc77f3c47c5e8758d133b8ec47dcc16ed207 (diff) |
[SCSI] lpfc: Balance locking
Commit 3163f725a5d071eea1830bbbfab78cfe3fc9baaf introduced locking in
lpfc_sli_hbqbuf_fill_hbqs, but missed unlocking on one exit.
Reported-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Acked-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index f53206411cd8..fc0d9501aba6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -648,28 +648,24 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) | |||
648 | unsigned long flags; | 648 | unsigned long flags; |
649 | struct hbq_dmabuf *hbq_buffer; | 649 | struct hbq_dmabuf *hbq_buffer; |
650 | 650 | ||
651 | if (!phba->hbqs[hbqno].hbq_alloc_buffer) { | 651 | if (!phba->hbqs[hbqno].hbq_alloc_buffer) |
652 | return 0; | 652 | return 0; |
653 | } | ||
654 | 653 | ||
655 | start = phba->hbqs[hbqno].buffer_count; | 654 | start = phba->hbqs[hbqno].buffer_count; |
656 | end = count + start; | 655 | end = count + start; |
657 | if (end > lpfc_hbq_defs[hbqno]->entry_count) { | 656 | if (end > lpfc_hbq_defs[hbqno]->entry_count) |
658 | end = lpfc_hbq_defs[hbqno]->entry_count; | 657 | end = lpfc_hbq_defs[hbqno]->entry_count; |
659 | } | ||
660 | 658 | ||
661 | /* Check whether HBQ is still in use */ | 659 | /* Check whether HBQ is still in use */ |
662 | spin_lock_irqsave(&phba->hbalock, flags); | 660 | spin_lock_irqsave(&phba->hbalock, flags); |
663 | if (!phba->hbq_in_use) { | 661 | if (!phba->hbq_in_use) |
664 | spin_unlock_irqrestore(&phba->hbalock, flags); | 662 | goto out; |
665 | return 0; | ||
666 | } | ||
667 | 663 | ||
668 | /* Populate HBQ entries */ | 664 | /* Populate HBQ entries */ |
669 | for (i = start; i < end; i++) { | 665 | for (i = start; i < end; i++) { |
670 | hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); | 666 | hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); |
671 | if (!hbq_buffer) | 667 | if (!hbq_buffer) |
672 | return 1; | 668 | goto err; |
673 | hbq_buffer->tag = (i | (hbqno << 16)); | 669 | hbq_buffer->tag = (i | (hbqno << 16)); |
674 | if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) | 670 | if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) |
675 | phba->hbqs[hbqno].buffer_count++; | 671 | phba->hbqs[hbqno].buffer_count++; |
@@ -677,8 +673,12 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) | |||
677 | (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); | 673 | (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); |
678 | } | 674 | } |
679 | 675 | ||
676 | out: | ||
680 | spin_unlock_irqrestore(&phba->hbalock, flags); | 677 | spin_unlock_irqrestore(&phba->hbalock, flags); |
681 | return 0; | 678 | return 0; |
679 | err: | ||
680 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
681 | return 1; | ||
682 | } | 682 | } |
683 | 683 | ||
684 | int | 684 | int |