public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: dann frazier <dannf@dannf.org>
Cc: Patrick McHardy <kaber@trash.net>,
	netdev@vger.kernel.org,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>
Subject: Re: shutdown oops in xt_compat_calc_jump
Date: Wed, 06 Apr 2011 18:49:27 +0200	[thread overview]
Message-ID: <1302108567.3209.121.camel@edumazet-laptop> (raw)
In-Reply-To: <1302108258.3209.117.camel@edumazet-laptop>

Le mercredi 06 avril 2011 à 18:44 +0200, Eric Dumazet a écrit :
> Le mercredi 06 avril 2011 à 10:25 -0600, dann frazier a écrit :
> 
> > Thanks Eric. Unfortunately that didn't solve the problem I am seeing.
> > I rebaselined (same kernel build as before), and found that I'm able
> > to reproduce this 100% of the time by running only:
> > 
> >   sudo ebtables -t filter --init-table
> > 
> > The backtrace I received was this:
> 
> 
> Oh yeah, I forgot to remove the WARN_ON_ONCE(1) at the end of
> xt_compat_calc_jump()
> 
> I focused on restoring ebtables (for example ebtables -A INPUT ...)
> 
> Just ignore the warning for the time being ;)
> 
> 
> # ebtables -A INPUT -p arp -s 00:01:02:03:04:05 -j ACCEPT
> # ebtables -A INPUT -p arp -s 00:01:02:03:04:06 -j ACCEPT
> # ebtables -L
> Bridge table: filter
> 
> Bridge chain: INPUT, entries: 2, policy: ACCEPT
> -p ARP -s 0:1:2:3:4:5 -j ACCEPT 
> -p ARP -s 0:1:2:3:4:6 -j ACCEPT 
> 
> Bridge chain: FORWARD, entries: 0, policy: ACCEPT
> 
> Bridge chain: OUTPUT, entries: 0, policy: ACCEPT
> 

[PATCH] netfilter: fix ebtables

commit 255d0dc34068a976 (netfilter: x_table: speedup compat operations)
made ebtables not working anymore.

1) xt_compat_calc_jump() is not an exact match lookup
2) compat_table_info() has a typo in xt_compat_init_offsets() call
3) compat_do_replace() misses a xt_compat_init_offsets() call

Reported-by: dann frazier <dannf@dannf.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
V2: 	remove a comment from V1 (as Patrick suggested)
	remove the WARN_ON_ONCE() in xt_compat_calc_jump()


 net/bridge/netfilter/ebtables.c |    3 ++-
 net/netfilter/x_tables.c        |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 893669c..c66aa80 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1766,7 +1766,7 @@ static int compat_table_info(const struct ebt_table_info *info,
 
 	newinfo->entries_size = size;
 
-	xt_compat_init_offsets(AF_INET, info->nentries);
+	xt_compat_init_offsets(NFPROTO_BRIDGE, info->nentries);
 	return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info,
 							entries, newinfo);
 }
@@ -2240,6 +2240,7 @@ static int compat_do_replace(struct net *net, void __user *user,
 
 	xt_compat_lock(NFPROTO_BRIDGE);
 
+	xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries);
 	ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state);
 	if (ret < 0)
 		goto out_unlock;
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index a9adf4c..8a025a5 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -455,6 +455,7 @@ void xt_compat_flush_offsets(u_int8_t af)
 		vfree(xt[af].compat_tab);
 		xt[af].compat_tab = NULL;
 		xt[af].number = 0;
+		xt[af].cur = 0;
 	}
 }
 EXPORT_SYMBOL_GPL(xt_compat_flush_offsets);
@@ -473,8 +474,7 @@ int xt_compat_calc_jump(u_int8_t af, unsigned int offset)
 		else
 			return mid ? tmp[mid - 1].delta : 0;
 	}
-	WARN_ON_ONCE(1);
-	return 0;
+	return left ? tmp[left - 1].delta : 0;
 }
 EXPORT_SYMBOL_GPL(xt_compat_calc_jump);
 


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

  reply	other threads:[~2011-04-06 16:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 19:48 shutdown oops in xt_compat_calc_jump dann frazier
2011-04-04 20:02 ` Patrick McHardy
2011-04-04 20:37   ` Eric Dumazet
2011-04-04 21:17     ` dann frazier
2011-04-04 22:48     ` Eric Dumazet
2011-04-05  6:24       ` Eric Dumazet
2011-04-05  7:17         ` Eric Dumazet
2011-04-05 10:41           ` Patrick McHardy
2011-04-05 21:08             ` dann frazier
2011-04-05 23:42           ` Florian Westphal
2011-04-06  4:42             ` Eric Dumazet
2011-04-06  7:40               ` Florian Westphal
2011-04-06 16:25           ` dann frazier
2011-04-06 16:44             ` Eric Dumazet
2011-04-06 16:49               ` Eric Dumazet [this message]
2011-04-06 18:45                 ` dann frazier
2011-04-21  8:57                 ` 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=1302108567.3209.121.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=dannf@dannf.org \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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