netdev
[Top] [All Lists]

Re: 2.6.11 on AMD64 traps

To: Andre Tomt <andre@xxxxxxxx>
Subject: Re: 2.6.11 on AMD64 traps
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Wed, 09 Mar 2005 20:45:35 +0100
Cc: Michal Vanco <vanco@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Netdev <netdev@xxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>
In-reply-to: <422DF07D.7010908@xxxxxxxx>
References: <200503081900.18686.vanco@xxxxxxxx> <422DF07D.7010908@xxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20050106 Debian/1.7.5-1
Michal Vanco wrote:

I see this problem running 2.6.11 on dual AMD64:

Running quagga routing daemon (ospf+bgp) and issuing "netstat -rn |wc -l" command while quagga tries to load more than 154000 routes from its bgp neighbours causes this trap:

This patch should fix it. The crash is caused by stale pointers,
the pointers in fib_iter_state are not reloaded after seq->stop()
followed by seq->start(pos > 0).

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/09 20:41:46+01:00 kaber@xxxxxxxxxxxx 
#   [IPV4]: Fix crash while reading /proc/net/route caused by stale pointers
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# net/ipv4/fib_hash.c
#   2005/03/09 20:41:37+01:00 kaber@xxxxxxxxxxxx +11 -1
#   [IPV4]: Fix crash while reading /proc/net/route caused by stale pointers
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
diff -Nru a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
--- a/net/ipv4/fib_hash.c       2005-03-09 20:43:55 +01:00
+++ b/net/ipv4/fib_hash.c       2005-03-09 20:43:55 +01:00
@@ -919,13 +919,23 @@
        return fa;
 }
 
+static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos)
+{
+       struct fib_alias *fa = fib_get_first(seq);
+
+       if (fa)
+               while (pos && (fa = fib_get_next(seq)))
+                       --pos;
+       return pos ? NULL : fa;
+}
+
 static void *fib_seq_start(struct seq_file *seq, loff_t *pos)
 {
        void *v = NULL;
 
        read_lock(&fib_hash_lock);
        if (ip_fib_main_table)
-               v = *pos ? fib_get_next(seq) : SEQ_START_TOKEN;
+               v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
        return v;
 }
 
<Prev in Thread] Current Thread [Next in Thread>