Patchwork text ematch: check for NULL pointer before destroying textsearch config

login
register
mail settings
Submitter Thomas Graf
Date Oct. 31, 2010, 8:06 a.m.
Message ID <20101031080635.GA22639@canuck.infradead.org>
Download mbox | patch
Permalink /patch/69700/
State Accepted
Delegated to: David Miller
Headers show

Comments

Thomas Graf - Oct. 31, 2010, 8:06 a.m.
While validating the configuration em_ops is already set, thus the
individual destroy functions are called, but the ematch data has
not been allocated and associated with the ematch yet.

Signed-off-by: Thomas Graf <tgraf@infradead.org>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Oct. 31, 2010, 4:38 p.m.
From: Thomas Graf <tgraf@infradead.org>
Date: Sun, 31 Oct 2010 04:06:35 -0400

> While validating the configuration em_ops is already set, thus the
> individual destroy functions are called, but the ematch data has
> not been allocated and associated with the ematch yet.
> 
> Signed-off-by: Thomas Graf <tgraf@infradead.org>

Applied, thanks Thomas.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: net-2.6/net/sched/em_text.c
===================================================================
--- net-2.6.orig/net/sched/em_text.c
+++ net-2.6/net/sched/em_text.c
@@ -103,7 +103,8 @@  retry:
 
 static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m)
 {
-	textsearch_destroy(EM_TEXT_PRIV(m)->config);
+	if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config)
+		textsearch_destroy(EM_TEXT_PRIV(m)->config);
 }
 
 static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)