From: Jing Wang <windsdaemon@gmail.com>
To: davem@davemloft.net, jhs@mojatatu.com, netdev@vger.kernel.org
Cc: Jing Wang <windsdaemon@gmail.com>
Subject: [PATCH 1/1] net:sched fix a bug about memery leak
Date: Thu, 24 Oct 2013 17:12:44 +0800 [thread overview]
Message-ID: <1382605964-2693-1-git-send-email-windsdaemon@gmail.com> (raw)
From: Jing Wang <windsdaemon@gmail.com>
the code isn't properly release memory
Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
net/sched/cls_route.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 37da567..118f8d5 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -466,11 +466,11 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
goto reinsert;
}
- err = -ENOBUFS;
+ err = -ENOMEM;
if (head == NULL) {
head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
if (head == NULL)
- goto errout;
+ goto errhead;
tcf_tree_lock(tp);
tp->root = head;
@@ -479,7 +479,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
if (f == NULL)
- goto errout;
+ goto errflt;
err = route4_set_parms(net, tp, base, f, handle, head, tb,
tca[TCA_RATE], 1);
@@ -517,6 +517,9 @@ reinsert:
errout:
kfree(f);
+errflt:
+ kfree(head);
+errhead:
return err;
}
--
1.7.1
next reply other threads:[~2013-10-24 9:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 9:12 Jing Wang [this message]
2013-10-24 9:33 ` [PATCH 1/1] net:sched fix a bug about memery leak Eric Dumazet
2013-10-24 14:07 ` Christoph Paasch
2013-10-24 14:23 ` Christoph Paasch
2013-10-24 14:10 ` Sergei Shtylyov
-- strict thread matches above, loose matches on Subject: below --
2013-10-24 9:06 Jing Wang
2013-10-24 14:05 ` 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=1382605964-2693-1-git-send-email-windsdaemon@gmail.com \
--to=windsdaemon@gmail.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
/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.