public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Chris Wright <chrisw@osdl.org>
Cc: linux-kernel@vger.kernel.org, stable@kernel.org,
	shemminger@osdl.org, torvalds@osdl.org, akpm@osdl.org,
	alan@lxorguk.ukuu.org.uk, jmforbes@linuxtx.org,
	zwane@arm.linux.org.uk, cliffw@osdl.org, tytso@mit.edu,
	rddunlap@osdl.org
Subject: Re: [5/9] [TUN] Fix check for underflow
Date: Thu, 17 Mar 2005 01:13:28 +0100	[thread overview]
Message-ID: <4238CBA8.1050807@trash.net> (raw)
In-Reply-To: <20050316235502.GD5389@shell0.pdx.osdl.net>

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

Chris Wright wrote:
> -stable review patch.  If anyone has any objections, please let us know.
> 

I agree to both patches and additionally propose this one.
It fixes a crash when reading /proc/net/route (netstat -rn)
while routes are changed. I've seen two bugreports of users
beeing hit by this bug, one for 2.6.10, one for 2.6.11.

Regards
Patrick

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

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/10 18:20:44-08:00 kaber@trash.net 
#   [IPV4]: Fix crash while reading /proc/net/route caused by stale pointers
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
#   Signed-off-by: David S. Miller <davem@davemloft.net>
# 
# net/ipv4/fib_hash.c
#   2005/03/10 18:20:30-08:00 kaber@trash.net +11 -1
#   [IPV4]: Fix crash while reading /proc/net/route caused by stale pointers
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
#   Signed-off-by: David S. Miller <davem@davemloft.net>
# 
diff -Nru a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
--- a/net/ipv4/fib_hash.c	2005-03-17 00:58:42 +01:00
+++ b/net/ipv4/fib_hash.c	2005-03-17 00:58:42 +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-17  0:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-16 23:53 [0/9] -stable review Chris Wright
2005-03-16 23:54 ` [1/9] [ALSA] Fix stereo mutes on Surround volume control Chris Wright
2005-03-16 23:54 ` [2/9] Possible AMD8111e free irq issue Chris Wright
2005-03-17  0:19   ` Ian Pilcher
2005-03-17  1:03     ` Chris Wright
2005-03-17  1:13       ` Ian Pilcher
2005-03-17  2:00     ` Jeff Garzik
2005-03-16 23:54 ` [3/9] [IPSEC]: Fix __xfrm_find_acq_byseq() Chris Wright
2005-03-16 23:54 ` [4/9] NetROM locking Chris Wright
2005-03-16 23:55 ` [5/9] [TUN] Fix check for underflow Chris Wright
2005-03-17  0:13   ` Patrick McHardy [this message]
2005-03-17  0:23     ` Chris Wright
2005-03-16 23:55 ` [6/9] tasklist left locked Chris Wright
2005-03-16 23:55 ` [7/9] Timercode race in AX.25 Chris Wright
2005-03-16 23:55 ` [8/9] Possible VIA-Rhine free irq issue Chris Wright
2005-03-16 23:55 ` [9/9] Fix kernel panic on receive with WAN Hitachi SCA HD6457x Chris Wright

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=4238CBA8.1050807@trash.net \
    --to=kaber@trash.net \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=chrisw@osdl.org \
    --cc=cliffw@osdl.org \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    --cc=shemminger@osdl.org \
    --cc=stable@kernel.org \
    --cc=torvalds@osdl.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /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