Re: IPv6 oops on ifup in latest BK

From: YOSHIFUJI Hideaki / 吉藤英明
Date: Tue Aug 24 2004 - 03:22:37 EST


In article <20040823235123.71f18c04.davem@xxxxxxxxxx> (at Mon, 23 Aug 2004 23:51:23 -0700), "David S. Miller" <davem@xxxxxxxxxx> says:

> > Attached minicom.cap.txt gives the ksymoops output and dmesg output.
> > Appears to die in ipv6_get_hoplimit.
>
> Yoshifuji-san, it is rt6i_dev changes. The problem is that
> ipv6_get_hoplimit() gets called with NULL dev.
:
> It is this piece of code in ip6_route_add():
>
> if (dev && dev != &loopback_dev) {
>
> It does not handle the case where dev == NULL correctly.
> Original code did do the right thing:
>
> if (dev)
> dev_put(dev);
> dev = &loopback_dev;
> dev_hold(dev);

Good catch and spotting. Please try this patch.
Thank you.

===== net/ipv6/route.c 1.88 vs edited =====
--- 1.88/net/ipv6/route.c 2004-08-17 11:25:06 +09:00
+++ edited/net/ipv6/route.c 2004-08-24 17:09:10 +09:00
@@ -820,9 +820,12 @@
*/
if ((rtmsg->rtmsg_flags&RTF_REJECT) ||
(dev && (dev->flags&IFF_LOOPBACK) && !(addr_type&IPV6_ADDR_LOOPBACK))) {
- if (dev && dev != &loopback_dev) {
- dev_put(dev);
- in6_dev_put(idev);
+ /* hold loopback dev/idev if we haven't done so. */
+ if (dev != &loopback_dev) {
+ if (dev) {
+ dev_put(dev);
+ in6_dev_put(idev);
+ }
dev = &loopback_dev;
dev_hold(dev);
idev = in6_dev_get(dev);


--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@xxxxxxxxxxxxxx>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/