[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1579013000-14570-3-git-send-email-igor.druzhinin@citrix.com>
Date: Tue, 14 Jan 2020 14:43:20 +0000
From: Igor Druzhinin <igor.druzhinin@...rix.com>
To: <fcoe-devel@...n-fcoe.org>, <linux-scsi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <hare@...e.de>
CC: <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
Igor Druzhinin <igor.druzhinin@...rix.com>
Subject: [PATCH RESEND 2/2] scsi: libfc: drop extra rport reference in fc_rport_create()
The callers of this function seem to assume the reference is not taken
in case rport already exists. This results in one extra reference taken
on each rport re-discovery that will eventually get to inability to
free rport structure on port removal.
Signed-off-by: Igor Druzhinin <igor.druzhinin@...rix.com>
---
drivers/scsi/libfc/fc_rport.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index da6e97d..a43f9dd 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -133,8 +133,10 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
lockdep_assert_held(&lport->disc.disc_mutex);
rdata = fc_rport_lookup(lport, port_id);
- if (rdata)
+ if (rdata) {
+ kref_put(&rdata->kref, fc_rport_destroy);
return rdata;
+ }
if (lport->rport_priv_size > 0)
rport_priv_size = lport->rport_priv_size;
--
2.7.4
Powered by blists - more mailing lists