All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH PKT_SCHED 2/6]: Fix memory leaks in cls_u32.c error path
@ 2005-01-11 21:46 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2005-01-11 21:46 UTC (permalink / raw)
  To: David S. Miller; +Cc: Maillist netdev

[-- 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) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-11 21:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11 21:46 [PATCH PKT_SCHED 2/6]: Fix memory leaks in cls_u32.c error path Patrick McHardy

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.