netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH PKT_SCHED 2/6]: Fix memory leaks in cls_u32.c error path
Date: Tue, 11 Jan 2005 22:46:20 +0100	[thread overview]
Message-ID: <41E4492C.7050703@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 02.diff --]
[-- Type: text/x-patch, Size: 2055 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/11 20:25:26+01:00 kaber@coreworks.de 
#   [PKT_SCHED]: Fix memory leaks in cls_u32.c error path
#   
#   Also silence an unused-variable warning when CONFIG_CLS_U32_MARK is not set.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/sched/cls_u32.c
#   2005/01/11 20:25:16+01:00 kaber@coreworks.de +11 -5
#   [PKT_SCHED]: Fix memory leaks in cls_u32.c error path
#   
#   Also silence an unused-variable warning when CONFIG_CLS_U32_MARK is not set.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/sched/cls_u32.c b/net/sched/cls_u32.c
--- a/net/sched/cls_u32.c	2005-01-11 22:32:10 +01:00
+++ b/net/sched/cls_u32.c	2005-01-11 22:32:10 +01:00
@@ -549,7 +549,6 @@
 	struct tc_u_hnode *ht;
 	struct tc_u_knode *n;
 	struct tc_u32_sel *s;
-	struct tc_u32_mark *mark;
 	struct rtattr *opt = tca[TCA_OPTIONS-1];
 	struct rtattr *tb[TCA_U32_MAX];
 	u32 htid;
@@ -654,15 +653,22 @@
 	n->fshift = i;
 }
 
-#ifdef CONFIG_CLS_U32_MARK                                                                                                                                             
+#ifdef CONFIG_CLS_U32_MARK
 	if (tb[TCA_U32_MARK-1]) {
-		if (RTA_PAYLOAD(tb[TCA_U32_MARK-1]) < sizeof(struct tc_u32_mark))
+		struct tc_u32_mark *mark;
+
+		if (RTA_PAYLOAD(tb[TCA_U32_MARK-1]) < sizeof(struct tc_u32_mark)) {
+#ifdef CONFIG_CLS_U32_PERF
+			kfree(n->pf);
+#endif
+			kfree(n);
 			return -EINVAL;
+		}
 		mark = RTA_DATA(tb[TCA_U32_MARK-1]);
 		memcpy(&n->mark, mark, sizeof(struct tc_u32_mark));
 		n->mark.success = 0;
-	}                                                                                                                                                                
-#endif                                                                                                                                                                 
+	}
+#endif
 
 	err = u32_set_parms(tp, base, ht, n, tb, tca[TCA_RATE-1]);
 	if (err == 0) {

                 reply	other threads:[~2005-01-11 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=41E4492C.7050703@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.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).