linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: Borislav Petkov <bp@alien8.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	Robert Richter <rrichter@marvell.com>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: emamd001@umn.edu, Navid Emamdoost <navid.emamdoost@gmail.com>
Subject: [PATCH] EDAC: Fix memory leak in i5100_init_one
Date: Thu, 21 Nov 2019 13:40:41 -0600	[thread overview]
Message-ID: <20191121194043.22378-1-navid.emamdoost@gmail.com> (raw)

In the implementation of i5100_init_one(), the allocated mci is not
correctly released in cases of failure. The release via edac_mc_free()
should be reached by label bail_einj and subsequents.

Fixes: 52608ba20546 ("i5100_edac: probe for device 19 function 0")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/edac/i5100_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
index 251f2b692785..710fabd5fba1 100644
--- a/drivers/edac/i5100_edac.c
+++ b/drivers/edac/i5100_edac.c
@@ -1149,12 +1149,12 @@ static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 bail_scrub:
 	priv->scrub_enable = 0;
 	cancel_delayed_work_sync(&(priv->i5100_scrubbing));
-	edac_mc_free(mci);
 
 bail_disable_einj:
 	pci_disable_device(einj);
 
 bail_einj:
+	edac_mc_free(mci);
 	pci_dev_put(einj);
 
 bail_disable_ch1:
-- 
2.17.1


             reply	other threads:[~2019-11-21 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 19:40 Navid Emamdoost [this message]
2019-11-21 20:39 ` [PATCH] EDAC: Fix memory leak in i5100_init_one Robert Richter

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=20191121194043.22378-1-navid.emamdoost@gmail.com \
    --to=navid.emamdoost@gmail.com \
    --cc=bp@alien8.de \
    --cc=emamd001@umn.edu \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rrichter@marvell.com \
    --cc=tony.luck@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 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).