Skip to content

Commit 22466da

Browse files
Johannes Thumshirnmartinkpetersen
authored andcommitted
lpfc: Fix possible NULL pointer dereference
Check for the existence of piocb->vport before accessing it. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: James Smart <james.smart@broadcom.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d242e66 commit 22466da

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,21 +1323,18 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
13231323
{
13241324
lockdep_assert_held(&phba->hbalock);
13251325

1326+
BUG_ON(!piocb || !piocb->vport);
1327+
13261328
list_add_tail(&piocb->list, &pring->txcmplq);
13271329
piocb->iocb_flag |= LPFC_IO_ON_TXCMPLQ;
13281330

13291331
if ((unlikely(pring->ringno == LPFC_ELS_RING)) &&
13301332
(piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) &&
13311333
(piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN) &&
1332-
(!(piocb->vport->load_flag & FC_UNLOADING))) {
1333-
if (!piocb->vport)
1334-
BUG();
1335-
else
1336-
mod_timer(&piocb->vport->els_tmofunc,
1337-
jiffies +
1338-
msecs_to_jiffies(1000 * (phba->fc_ratov << 1)));
1339-
}
1340-
1334+
(!(piocb->vport->load_flag & FC_UNLOADING)))
1335+
mod_timer(&piocb->vport->els_tmofunc,
1336+
jiffies +
1337+
msecs_to_jiffies(1000 * (phba->fc_ratov << 1)));
13411338

13421339
return 0;
13431340
}

0 commit comments

Comments
 (0)