Commit 3be30e0e authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.3.40: Fixed system panic due to unsafe walking and deleting linked list

Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent df0d085f
...@@ -1166,13 +1166,14 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) ...@@ -1166,13 +1166,14 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
static struct lpfc_scsi_buf* static struct lpfc_scsi_buf*
lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) 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 gflag = 0;
unsigned long pflag = 0; unsigned long pflag = 0;
int found = 0; int found = 0;
spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); 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, if (lpfc_test_rrq_active(phba, ndlp,
lpfc_cmd->cur_iocbq.sli4_lxritag)) lpfc_cmd->cur_iocbq.sli4_lxritag))
continue; continue;
...@@ -1186,8 +1187,8 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) ...@@ -1186,8 +1187,8 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
&phba->lpfc_scsi_buf_list_get); &phba->lpfc_scsi_buf_list_get);
INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put);
spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag);
list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
list) { &phba->lpfc_scsi_buf_list_get, list) {
if (lpfc_test_rrq_active( if (lpfc_test_rrq_active(
phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag))
continue; continue;
......
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