Skip to content

Commit d0385d9

Browse files
Sesidhar BeddelJames Bottomley
authored andcommitted
[SCSI] fnic: Kernel panic while running sh/nosh with max lun cfg
Kernel panics due to NULL lport while executing the log message because of synchronization issues between libfc and scsi transport fc. Checking for NULL pointers at the beginning of this routine would resolve the issue from kernel panic point of view. Signed-off-by: Sesidhar Baddel <sebaddel@cisco.com> Signed-off-by: Hiral Patel <hiralpat@cisco.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 1259c5d commit d0385d9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,12 +1416,29 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
14161416
unsigned long flags;
14171417
struct scsi_cmnd *sc;
14181418
struct scsi_lun fc_lun;
1419-
struct fc_rport_libfc_priv *rdata = rport->dd_data;
1420-
struct fc_lport *lport = rdata->local_port;
1421-
struct fnic *fnic = lport_priv(lport);
1419+
struct fc_rport_libfc_priv *rdata;
1420+
struct fc_lport *lport;
1421+
struct fnic *fnic;
14221422
struct fc_rport *cmd_rport;
14231423
enum fnic_ioreq_state old_ioreq_state;
14241424

1425+
if (!rport) {
1426+
printk(KERN_ERR "fnic_terminate_rport_io: rport is NULL\n");
1427+
return;
1428+
}
1429+
rdata = rport->dd_data;
1430+
1431+
if (!rdata) {
1432+
printk(KERN_ERR "fnic_terminate_rport_io: rdata is NULL\n");
1433+
return;
1434+
}
1435+
lport = rdata->local_port;
1436+
1437+
if (!lport) {
1438+
printk(KERN_ERR "fnic_terminate_rport_io: lport is NULL\n");
1439+
return;
1440+
}
1441+
fnic = lport_priv(lport);
14251442
FNIC_SCSI_DBG(KERN_DEBUG,
14261443
fnic->lport->host, "fnic_terminate_rport_io called"
14271444
" wwpn 0x%llx, wwnn0x%llx, rport 0x%p, portid 0x%06x\n",

0 commit comments

Comments
 (0)