From: Andi Kleen <ak@suse.de>
To: Julian Anastasov <ja@ssi.bg>
Cc: linux-kernel@vger.kernel.org, kain@kain.org
Subject: Re: OOPS: Multipath routing 2.4.17
Date: 02 Mar 2002 00:00:56 +0100 [thread overview]
Message-ID: <p73pu2nki53.fsf@oldwotan.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.44.0203012316120.1420-100000@u.domain.uli.suse.lists.linux.kernel>
In-Reply-To: Julian Anastasov's message of "1 Mar 2002 23:30:20 +0100"
I wrote:
>In theory yes, but the
>
>#if 1
> if (power <= 0) {
> printk(KERN_CRIT "impossible 777\n");
> return;
> }
>#endif
>
>should stop it; making it just not work, but not crash.
>If he still gets a division by zero then something else is fishy.
Ignore the objection. The division is using fi->fib_power not power,
so it is definitely racy and possible. Sorry for the brain fart.
Short term fix would be just to add a spinlock like this (untested).
I think using a new algorithm would be too risky at least for 2.4.
--- linux-work/net/ipv4/fib_semantics.c-FIBLOCK Tue Jan 15 11:05:17 2002
+++ linux-work/net/ipv4/fib_semantics.c Fri Mar 1 23:58:45 2002
@@ -35,6 +35,7 @@
#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/init.h>
+#include <linux/spinlock.h>
#include <net/ip.h>
#include <net/protocol.h>
@@ -45,6 +46,8 @@
#define FSprintk(a...)
+static spinlock_t fib_nh_lock = SPIN_LOCK_UNLOCKED;
+
static struct fib_info *fib_info_list;
static rwlock_t fib_info_lock = RW_LOCK_UNLOCKED;
int fib_info_cnt;
@@ -859,6 +862,8 @@
if (force)
scope = -1;
+ spin_lock_bh(&fib_nh_lock);
+
for_fib_info() {
if (local && fi->fib_prefsrc == local) {
fi->fib_flags |= RTNH_F_DEAD;
@@ -885,6 +890,7 @@
}
}
} endfor_fib_info();
+ spin_unlock_bh(&fib_nh_lock);
return ret;
}
@@ -902,6 +908,7 @@
if (!(dev->flags&IFF_UP))
return 0;
+ spin_lock_bh(&fib_nh_lock);
for_fib_info() {
int alive = 0;
@@ -924,6 +931,7 @@
ret++;
}
} endfor_fib_info();
+ spin_unlock_bh(&fib_nh_lock);
return ret;
}
@@ -937,6 +945,7 @@
struct fib_info *fi = res->fi;
int w;
+ spin_lock_bh(&fib_nh_lock);
if (fi->fib_power <= 0) {
int power = 0;
change_nexthops(fi) {
@@ -949,6 +958,7 @@
#if 1
if (power <= 0) {
printk(KERN_CRIT "impossible 777\n");
+ spin_unlock_bh(&fib_nh_lock);
return;
}
#endif
@@ -967,10 +977,13 @@
nh->nh_power--;
fi->fib_power--;
res->nh_sel = nhsel;
+ spin_unlock_bh(&fib_nh_lock);
return;
}
}
} endfor_nexthops(fi);
+
+ spin_unlock_bh(&fib_nh_lock);
#if 1
printk(KERN_CRIT "impossible 888\n");
-Andi
next prev parent reply other threads:[~2002-03-01 23:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44.0203012316120.1420-100000@u.domain.uli.suse.lists.linux.kernel>
2002-03-01 22:43 ` OOPS: Multipath routing 2.4.17 Andi Kleen
2002-03-02 1:01 ` Julian Anastasov
2002-03-01 23:05 ` Andi Kleen
2002-03-01 23:00 ` Andi Kleen [this message]
2002-03-02 1:20 ` Julian Anastasov
2002-03-02 0:27 Julian Anastasov
2002-03-02 0:25 ` Kain
2002-03-02 12:59 ` kuznet
2002-03-02 15:28 ` Julian Anastasov
2002-03-02 14:36 ` kuznet
2002-03-02 18:10 ` Julian Anastasov
[not found] <20020301173414.GA30037@kain.org.suse.lists.linux.kernel>
2002-03-01 18:12 ` Andi Kleen
2002-03-01 19:04 ` Kain
-- strict thread matches above, loose matches on Subject: below --
2002-03-01 17:34 Kain
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=p73pu2nki53.fsf@oldwotan.suse.de \
--to=ak@suse.de \
--cc=ja@ssi.bg \
--cc=kain@kain.org \
--cc=linux-kernel@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