All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Jack Morgan <jack.morgan@intel.com>,
	Mark Rustad <mark.d.rustad@intel.com>
Subject: [PATCH 7/8] fcoe: Stop fc_rport_priv structure leak
Date: Tue, 09 Jul 2013 12:47:42 -0700	[thread overview]
Message-ID: <20130709194742.10724.43159.stgit@fritz> (raw)
In-Reply-To: <20130709194705.10724.64013.stgit@fritz>

From: Mark Rustad <mark.d.rustad@intel.com>

When repeatedly doing rmmod and modprobe on the ixgbe
driver while FCoE is active in a VN2VN configuration,
memory leaks would be discovered by kmemleak with the
following backtrace:

unreferenced object 0xffff88003d076000 (size 1024):
  comm "kworker/0:3", pid 2998, jiffies 4295436448 (age 1015.332s)
  hex dump (first 32 bytes):
    48 8a fe 6f 00 88 ff ff 00 00 00 00 00 00 00 00  H..o............
    01 00 00 00 02 00 00 00 7b ac 87 21 1b 00 00 10  ........{..!....
  backtrace:
    [<ffffffff814b308b>] kmemleak_alloc+0x5b/0xc0
    [<ffffffff8115c6e8>] __kmalloc+0xd8/0x1b0
    [<ffffffffa0216638>] fc_rport_create+0x48/0x1f0 [libfc]
    [<ffffffffa023cd86>] fcoe_ctlr_vn_add.isra.10+0x56/0x1a0 [libfcoe]
    [<ffffffffa023f440>] fcoe_ctlr_vn_recv+0x8b0/0xab0 [libfcoe]
    [<ffffffffa023fb06>] fcoe_ctlr_recv_work+0x4c6/0xf60 [libfcoe]
    [<ffffffff81067404>] process_one_work+0x1e4/0x4d0
    [<ffffffff81068def>] worker_thread+0x10f/0x380
    [<ffffffff8107019a>] kthread+0xea/0xf0
    [<ffffffff814d32ec>] ret_from_fork+0x7c/0xb0
    [<ffffffffffffffff>] 0xffffffffffffffff

This patch stops the leak of the fc_rport_priv structure.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Jack Morgan <jack.morgan@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/fcoe/fcoe_ctlr.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 795843d..203415e 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -2090,7 +2090,11 @@ static struct fc_rport_operations fcoe_ctlr_vn_rport_ops = {
  */
 static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport)
 {
+	struct fc_rport_priv *rdata;
+
 	mutex_lock(&lport->disc.disc_mutex);
+	list_for_each_entry_rcu(rdata, &lport->disc.rports, peers)
+		lport->tt.rport_logoff(rdata);
 	lport->disc.disc_callback = NULL;
 	mutex_unlock(&lport->disc.disc_mutex);
 }


  parent reply	other threads:[~2013-07-09 19:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 19:47 [PATCH 0/8] libfc, libfcoe, fcoe updates for 3.11(+) Robert Love
2013-07-09 19:47 ` [PATCH 1/8] libfc: Reject PLOGI from nodes with incompatible role Robert Love
2013-07-09 19:47 ` [PATCH 2/8] fcoe: Fix smatch warning in fcoe_fdmi_info function Robert Love
2013-07-09 19:47 ` [PATCH 3/8] fcoe: fix the link error status block sparse warnings Robert Love
2013-07-09 19:47 ` [PATCH 4/8] libfc: Remove extra space in fc_exch_timer_cancel definition Robert Love
2013-07-09 19:53   ` Neil Horman
2013-07-09 19:47 ` [PATCH 5/8] libfc: Differentiate echange timer cancellation debug statements Robert Love
2013-07-09 19:54   ` Neil Horman
2013-07-09 19:47 ` [PATCH 6/8] libfcoe: Fix meaningless log statement Robert Love
2013-07-09 19:54   ` Neil Horman
2013-07-09 19:47 ` Robert Love [this message]
2013-07-09 19:47 ` [PATCH 8/8] fcoe: Reduce number of sparse warnings Robert Love

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=20130709194742.10724.43159.stgit@fritz \
    --to=robert.w.love@intel.com \
    --cc=jack.morgan@intel.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mark.d.rustad@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.