netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Chris Madden <chris@reflexsecurity.com>
Cc: hadi@cyberus.ca, netdev@vger.kernel.org
Subject: Re: Oops in filter add
Date: Tue, 20 Mar 2007 15:57:57 +0100	[thread overview]
Message-ID: <45FFF675.8040501@trash.net> (raw)
In-Reply-To: <45FFF455.80003@trash.net>

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

Patrick McHardy wrote:
> Chris Madden wrote:
> 
>>Ok, I replaced ingress_lock with queue_lock in ing_filter and it died in
>>the same place.  Trace below (looks to be substantively the same)...
>>
>>If I am reading tc_ctl_tfilter correctly, we are adding our new
>>tcf_proto to the end of the list, and it is getting used before the
>>change function is getting executed on it.   Locking the ingress_lock in
>>qdisc_lock_tree ( in addition to the extant queue_lock )seems to have
>>the same effect; I can get  a traceback from that if its useful.
> 
> 
> 
> The problem is that some classifiers (like basic, fw and route)
> implement empty ->init functions, although fw and route properly
> deal with it in their classification functions. The ->init function
> should allocate and initalize tp->root, which basic fails to do.
> If you give me a few hours I'll cook up a patch for this.


Actually its only cls_basic thats broken, in case of route and fw
its intentional for backwards-compatibility.

Can you try this patch please?


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 822 bytes --]

diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index fad08e5..ed788d0 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -81,6 +81,13 @@ static void basic_put(struct tcf_proto *
 
 static int basic_init(struct tcf_proto *tp)
 {
+	struct basic_head *head;
+
+	head = kzalloc(sizeof(*head), GFP_KERNEL);
+	if (head == NULL)
+		return -ENOMEM;
+	INIT_LIST_HEAD(&head->flist);
+	tp->root = head;
 	return 0;
 }
 
@@ -175,16 +182,6 @@ static int basic_change(struct tcf_proto
 		return basic_set_parms(tp, f, base, tb, tca[TCA_RATE-1]);
 	}
 
-	err = -ENOBUFS;
-	if (head == NULL) {
-		head = kzalloc(sizeof(*head), GFP_KERNEL);
-		if (head == NULL)
-			goto errout;
-
-		INIT_LIST_HEAD(&head->flist);
-		tp->root = head;
-	}
-
 	f = kzalloc(sizeof(*f), GFP_KERNEL);
 	if (f == NULL)
 		goto errout;

  reply	other threads:[~2007-03-20 14:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19 20:10 Oops in filter add Chris Madden
2007-03-20  2:22 ` David Miller
2007-03-20  6:54   ` jamal
2007-03-20  6:58     ` Patrick McHardy
2007-03-20  7:18       ` jamal
2007-03-20  7:29         ` Patrick McHardy
2007-03-20  9:25           ` jamal
2007-03-20 10:54             ` Chris Madden
2007-03-20 11:02               ` Patrick McHardy
2007-03-20 10:58             ` Patrick McHardy
2007-03-21  9:33               ` jamal
2007-03-20 14:15     ` Chris Madden
2007-03-20 14:48       ` Patrick McHardy
2007-03-20 14:57         ` Patrick McHardy [this message]
2007-03-20 15:11           ` Thomas Graf
2007-03-20 15:13             ` Patrick McHardy
2007-03-20 16:27               ` Chris Madden
2007-03-20 17:06                 ` Patrick McHardy

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=45FFF675.8040501@trash.net \
    --to=kaber@trash.net \
    --cc=chris@reflexsecurity.com \
    --cc=hadi@cyberus.ca \
    --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 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).