diff options
author | James Smart <james.smart@emulex.com> | 2014-06-16 11:01:31 +0530 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2014-06-16 18:24:48 +1000 |
commit | 831ab9dae87006fd03df9ebd387c85d18d4da591 (patch) | |
tree | dc4fdc6a0a2cf6d9e4908b7c9701739857f35c68 | |
parent | e75e39631f181975e965ad90f1f349bdb1563a3d (diff) | |
download | powerpc-831ab9dae87006fd03df9ebd387c85d18d4da591.tar.gz |
lpfc 8.3.40: Fixed system panic due to unsafe walking and deleting linked list
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 3be30e0e4486b3568044efe27caf405296d7845a)
Signed-off-by: Sanket Rathi <sanket@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 413de995bcce3d..cc31aacb8ff80f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -1147,13 +1147,14 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) static struct lpfc_scsi_buf* lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) { - struct lpfc_scsi_buf *lpfc_cmd ; + struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next; unsigned long gflag = 0; unsigned long pflag = 0; int found = 0; spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); - list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, list) { + list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, + &phba->lpfc_scsi_buf_list_get, list) { if (lpfc_test_rrq_active(phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) continue; @@ -1167,8 +1168,8 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) &phba->lpfc_scsi_buf_list_get); INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); - list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, - list) { + list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, + &phba->lpfc_scsi_buf_list_get, list) { if (lpfc_test_rrq_active( phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) continue; |