diff options
author | Hannes Reinecke <hare@suse.com> | 2019-03-26 08:38:49 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-03-28 02:54:53 +0100 |
commit | 56efc304b18cbfa4a2b355c0ae817f61acea38c4 (patch) | |
tree | 3d07b1605b8dcb121ee71eaa655bcb5f469e9180 /drivers/scsi/qedf/qedf_main.c | |
parent | scsi: qedf: Add missing return in qedf_scsi_done() (diff) | |
download | linux-56efc304b18cbfa4a2b355c0ae817f61acea38c4.tar.xz linux-56efc304b18cbfa4a2b355c0ae817f61acea38c4.zip |
scsi: qedf: fc_rport_priv reference counting fixes
The fc_rport_priv structure is reference counted, so we need to ensure that
the reference is increased before accessing the structure.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qedf/qedf_main.c')
-rw-r--r-- | drivers/scsi/qedf/qedf_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index ad72a1eb3bca..84834d4490ff 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1334,6 +1334,8 @@ static void qedf_upload_connection(struct qedf_ctx *qedf, static void qedf_cleanup_fcport(struct qedf_ctx *qedf, struct qedf_rport *fcport) { + struct fc_rport_priv *rdata = fcport->rdata; + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Cleaning up portid=%06x.\n", fcport->rdata->ids.port_id); @@ -1345,6 +1347,7 @@ static void qedf_cleanup_fcport(struct qedf_ctx *qedf, qedf_free_sq(qedf, fcport); fcport->rdata = NULL; fcport->qedf = NULL; + kref_put(&rdata->kref, fc_rport_destroy); } /** @@ -1420,6 +1423,8 @@ static void qedf_rport_event_handler(struct fc_lport *lport, break; } + /* Initial reference held on entry, so this can't fail */ + kref_get(&rdata->kref); fcport->rdata = rdata; fcport->rport = rport; |