From: Javed Hasan <jhasan@marvell.com>
To: <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>,
<GR-QLogic-Storage-Upstream@marvell.com>, <jhasan@marvell.com>
Subject: [PATCH 2/2] scsi: fcoe: memory leak fix in fcoe_sysfs_fcf_del().
Date: Wed, 29 Jul 2020 01:18:24 -0700 [thread overview]
Message-ID: <20200729081824.30996-3-jhasan@marvell.com> (raw)
In-Reply-To: <20200729081824.30996-1-jhasan@marvell.com>
In fcoe_sysfs_fcf_del(), we first deleted the fcf from the list and
free it if ctlr_dev is not NULL.
This was causing the memory leak for fcf.
This fix is just to free the fcf even if ctlr_dev is NULL or not.
Reviewed-by: Girish Basrur <gbasrur@marvell.com>
Reviewed-by: Santosh Vernekar <svernekar@marvell.com>
Reviewed-by: Saurav Kashyap <skashyap@marvell.com>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
drivers/scsi/fcoe/fcoe_ctlr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 1791a39..d2f5c6f 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -255,9 +255,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
WARN_ON(!fcf_dev);
new->fcf_dev = NULL;
fcoe_fcf_device_delete(fcf_dev);
- kfree(new);
mutex_unlock(&cdev->lock);
}
+kfree(new);
}
/**
--
1.8.3.1
next prev parent reply other threads:[~2020-07-29 8:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 8:18 [PATCH 0/2] qedf: Memory leak fixes for fcoe and libfc Javed Hasan
2020-07-29 8:18 ` [PATCH 1/2] scsi: libfc: free skb in fc_disc_gpn_id_resp() for valid cases Javed Hasan
2020-07-29 8:18 ` Javed Hasan [this message]
2020-08-05 1:17 ` [PATCH 0/2] qedf: Memory leak fixes for fcoe and libfc Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200729081824.30996-3-jhasan@marvell.com \
--to=jhasan@marvell.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).