From: Neil Armstrong <narmstrong@baylibre.com>
To: "David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
vivien.didelot@savoirfairelinux.com, Andrew Lunn <andrew@lunn.ch>,
Fabian Frederick <fabf@skynet.be>,
Pavel Nakonechny <pavel.nakonechny@skitlab.ru>,
Joe Perches <joe@perches.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
nbd@openwrt.org, sergei.shtylyov@cogentembedded.com
Subject: [PATCH v2 1/5] net: dsa: add missing kfree on remove
Date: Sat, 3 Oct 2015 16:25:57 +0200 [thread overview]
Message-ID: <560FE575.7000003@baylibre.com> (raw)
To prevent memory leakage on unbinding, add missing kfree calls.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
net/dsa/dsa.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index c59fa5d..12cec40 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -914,8 +914,10 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
for (i = 0; i < dst->pd->nr_chips; i++) {
struct dsa_switch *ds = dst->ds[i];
- if (ds != NULL)
+ if (ds != NULL) {
dsa_switch_destroy(ds);
+ kfree(ds);
+ }
}
}
@@ -924,6 +926,7 @@ static int dsa_remove(struct platform_device *pdev)
struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
dsa_remove_dst(dst);
+ kfree(dst);
dsa_of_remove(&pdev->dev);
return 0;
--
1.9.1
next reply other threads:[~2015-10-03 14:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-03 14:25 Neil Armstrong [this message]
2015-10-03 14:33 ` [PATCH v2 1/5] net: dsa: add missing kfree on remove Sergei Shtylyov
2015-10-03 15:20 ` Neil Armstrong
2015-10-03 21:54 ` Sergei Shtylyov
2015-10-06 7:25 ` Neil Armstrong
2015-10-06 11:15 ` Sergei Shtylyov
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=560FE575.7000003@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=fabf@skynet.be \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nbd@openwrt.org \
--cc=netdev@vger.kernel.org \
--cc=pavel.nakonechny@skitlab.ru \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=vivien.didelot@savoirfairelinux.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).