scsi: qedf: missing kref_put in qedf_xmit()
authorHannes Reinecke <hare@suse.com>
Tue, 26 Mar 2019 07:38:43 +0000 (00:38 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Mar 2019 01:54:52 +0000 (21:54 -0400)
qedf_xmit() calls fc_rport_lookup(), but discards the returned rdata
structure almost immediately without decreasing the refcount.  This leads
to a refcount leak and the rdata never to be freed.

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>
drivers/scsi/qedf/qedf_main.c

index 9e186d7..b216a0f 100644 (file)
@@ -971,8 +971,10 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp)
                    "Dropping FCoE frame to %06x.\n", ntoh24(fh->fh_d_id));
                kfree_skb(skb);
                rdata = fc_rport_lookup(lport, ntoh24(fh->fh_d_id));
-               if (rdata)
+               if (rdata) {
                        rdata->retries = lport->max_rport_retry_count;
+                       kref_put(&rdata->kref, fc_rport_destroy);
+               }
                return -EINVAL;
        }
        /* End NPIV filtering */