Re: [TRIVIAL] Fix recent bug in fib_semantics.c

From: Herbert Xu
Date: Fri Sep 17 2004 - 23:18:45 EST


On Fri, Sep 17, 2004 at 09:37:15PM -0400, Jon Smirl wrote:
> Call stack at failure:
> e1000_exit_module
> ...pci calls...
> e1000_remove
> unregister_netdev
> unregister_netdevice
> notifier_call_chain
> fib_netdev_event
> fib_disable_ip
> error_code

Thanks. The following bug is probably your problem.

> Rest of the info has scrolled off the screen.

You should be able to hit Shift-PageUp to scroll up.

There is a thinko in the allocation for the devindex hash. We're
only giving it 8 elements when it should be 1<<8 elements.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
===== net/ipv4/fib_semantics.c 1.16 vs edited =====
--- 1.16/net/ipv4/fib_semantics.c 2004-09-18 04:11:04 +10:00
+++ edited/net/ipv4/fib_semantics.c 2004-09-18 14:08:55 +10:00
@@ -52,7 +52,8 @@
static unsigned int fib_info_cnt;

#define DEVINDEX_HASHBITS 8
-static struct hlist_head fib_info_devhash[DEVINDEX_HASHBITS];
+#define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS)
+static struct hlist_head fib_info_devhash[DEVINDEX_HASHSIZE];

#ifdef CONFIG_IP_ROUTE_MULTIPATH

@@ -229,7 +230,7 @@

static inline unsigned int fib_devindex_hashfn(unsigned int val)
{
- unsigned int mask = ((1U << DEVINDEX_HASHBITS) - 1);
+ unsigned int mask = DEVINDEX_HASHSIZE - 1;

return (val ^
(val >> DEVINDEX_HASHBITS) ^