| To: | "David S. Miller" <davem@xxxxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH PKT_SCHED 2/6]: Fix memory leaks in cls_u32.c error path |
| From: | Patrick McHardy <kaber@xxxxxxxxx> |
| Date: | Tue, 11 Jan 2005 22:46:20 +0100 |
| Cc: | Maillist netdev <netdev@xxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20041008 Debian/1.7.3-5 |
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/01/11 20:25:26+01:00 kaber@xxxxxxxxxxxx
# [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@xxxxxxxxx>
#
# net/sched/cls_u32.c
# 2005/01/11 20:25:16+01:00 kaber@xxxxxxxxxxxx +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@xxxxxxxxx>
#
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) {
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH PKT_SCHED 1/6]: Use rtattr_parse_nested where appropriate, Patrick McHardy |
|---|---|
| Next by Date: | [PATCH PKT_SCHED 3/6]: tc actions: disable bhs while lock is held in init path, Patrick McHardy |
| Previous by Thread: | [PATCH PKT_SCHED 1/6]: Use rtattr_parse_nested where appropriate, Patrick McHardy |
| Next by Thread: | [PATCH PKT_SCHED 3/6]: tc actions: disable bhs while lock is held in init path, Patrick McHardy |
| Indexes: | [Date] [Thread] [Top] [All Lists] |