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>
This commit is contained in:

committed by
Martin K. Petersen

orang tua
6f15d0c029
melakukan
56efc304b1
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user