netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Andre Tomt <andre@tomt.net>
Cc: Michal Vanco <vanco@satro.sk>,
	linux-kernel@vger.kernel.org, Netdev <netdev@oss.sgi.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: 2.6.11 on AMD64 traps
Date: Wed, 09 Mar 2005 20:45:35 +0100	[thread overview]
Message-ID: <422F525F.90404@trash.net> (raw)
In-Reply-To: <422DF07D.7010908@tomt.net>

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

> 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).


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

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/09 20:41:46+01:00 kaber@coreworks.de 
#   [IPV4]: Fix crash while reading /proc/net/route caused by stale pointers
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/fib_hash.c
#   2005/03/09 20:41:37+01:00 kaber@coreworks.de +11 -1
#   [IPV4]: Fix crash while reading /proc/net/route caused by stale pointers
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
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;
 }
 

  reply	other threads:[~2005-03-09 19:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200503081900.18686.vanco@satro.sk>
2005-03-08 18:35 ` 2.6.11 on AMD64 traps Andre Tomt
2005-03-09 19:45   ` Patrick McHardy [this message]
2005-03-09 20:24     ` Michal Vanco
2005-03-09 20:34       ` Patrick McHardy
2005-03-09 20:42         ` Michal Vanco
2005-03-09 21:05           ` Patrick McHardy
2005-03-09 21:17             ` Michal Vanco
2005-03-09 23:27               ` Patrick McHardy
2005-03-09 23:50                 ` Michal Vanco
2005-03-09 23:57                   ` Patrick McHardy
2005-03-10  0:43                     ` David S. Miller
2005-03-11  2:20     ` David S. Miller

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=422F525F.90404@trash.net \
    --to=kaber@trash.net \
    --cc=andre@tomt.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=vanco@satro.sk \
    /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).