diff mbox

[net] WARNING: CPU: 1 PID: 1 at net/batman-adv/hard-interface.c:92 batadv_is_on_batman_iface()

Message ID CAHA+R7Mhd2KYaU8THAd+O4HzQNRLxhpGccvEPOqWJRKAwZbpgQ@mail.gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Cong Wang May 22, 2014, 6:12 a.m. UTC
On Wed, May 21, 2014 at 9:42 PM, Jet Chen <jet.chen@intel.com> wrote:
> Hi Steffen,
>
> 0day kernel testing robot got the below dmesg and the first bad commit is
>
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
> commit 78ff4be45a4c51d8fb21ad92e4fabb467c6c3eeb
> Author:     Steffen Klassert <steffen.klassert@secunet.com>
> AuthorDate: Mon May 19 11:36:56 2014 +0200
> Commit:     David S. Miller <davem@davemloft.net>
> CommitDate: Wed May 21 02:08:32 2014 -0400
>
>     ip_tunnel: Initialize the fallback device properly
>         We need to initialize the fallback device to have a correct mtu
>     set on this device. Otherwise the mtu is set to null and the device
>     is unusable.
>         Fixes: fd58156e456d ("IPIP: Use ip-tunneling code.")
>     Cc: Pravin B Shelar <pshelar@nicira.com>
>     Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> +--------------------------------------------------------------------------------+------------+------------+
> |
> | d8d33c3b8a | 78ff4be45a |
> +--------------------------------------------------------------------------------+------------+------------+
> | boot_successes
> | 60         | 0          |
> | boot_failures
> | 0          | 20         |
> |
> WARNING:CPU:PID:at_net/batman-adv/hard-interface.c:batadv_is_on_batman_iface()
> | 0          | 20         |
> | backtrace:register_netdevice_notifier
> | 0          | 20         |
> | backtrace:batadv_init
> | 0          | 20         |
> | backtrace:kernel_init_freeable
> | 0          | 20         |
> +--------------------------------------------------------------------------------+------------+------------+
>

batman needs to fix:

        /* recurse over the parent device */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jet Chen May 22, 2014, 7:34 a.m. UTC | #1
On 05/22/2014 02:12 PM, Cong Wang wrote:
> On Wed, May 21, 2014 at 9:42 PM, Jet Chen <jet.chen@intel.com> wrote:
>> Hi Steffen,
>>
>> 0day kernel testing robot got the below dmesg and the first bad commit is
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
>> commit 78ff4be45a4c51d8fb21ad92e4fabb467c6c3eeb
>> Author:     Steffen Klassert <steffen.klassert@secunet.com>
>> AuthorDate: Mon May 19 11:36:56 2014 +0200
>> Commit:     David S. Miller <davem@davemloft.net>
>> CommitDate: Wed May 21 02:08:32 2014 -0400
>>
>>      ip_tunnel: Initialize the fallback device properly
>>          We need to initialize the fallback device to have a correct mtu
>>      set on this device. Otherwise the mtu is set to null and the device
>>      is unusable.
>>          Fixes: fd58156e456d ("IPIP: Use ip-tunneling code.")
>>      Cc: Pravin B Shelar <pshelar@nicira.com>
>>      Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
>>      Signed-off-by: David S. Miller <davem@davemloft.net>
>>
>> +--------------------------------------------------------------------------------+------------+------------+
>> |
>> | d8d33c3b8a | 78ff4be45a |
>> +--------------------------------------------------------------------------------+------------+------------+
>> | boot_successes
>> | 60         | 0          |
>> | boot_failures
>> | 0          | 20         |
>> |
>> WARNING:CPU:PID:at_net/batman-adv/hard-interface.c:batadv_is_on_batman_iface()
>> | 0          | 20         |
>> | backtrace:register_netdevice_notifier
>> | 0          | 20         |
>> | backtrace:batadv_init
>> | 0          | 20         |
>> | backtrace:kernel_init_freeable
>> | 0          | 20         |
>> +--------------------------------------------------------------------------------+------------+------------+
>>
>
> batman needs to fix:
>
> diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
> index b851cc5..fbda6b5 100644
> --- a/net/batman-adv/hard-interface.c
> +++ b/net/batman-adv/hard-interface.c
> @@ -83,7 +83,7 @@ static bool batadv_is_on_batman_iface(const struct
> net_device *net_dev)
>                  return true;
>
>          /* no more parents..stop recursion */
> -       if (net_dev->iflink == net_dev->ifindex)
> +       if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex)
>                  return false;
>
>          /* recurse over the parent device */
>
Your patch fixes that issue.

Tested-by: Jet Chen <jet.chen@intel.com>

Thanks,
Jet
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steffen Klassert May 22, 2014, 8:29 a.m. UTC | #2
On Wed, May 21, 2014 at 11:12:36PM -0700, Cong Wang wrote:
> 
> batman needs to fix:
> 
> diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
> index b851cc5..fbda6b5 100644
> --- a/net/batman-adv/hard-interface.c
> +++ b/net/batman-adv/hard-interface.c
> @@ -83,7 +83,7 @@ static bool batadv_is_on_batman_iface(const struct
> net_device *net_dev)
>                 return true;
> 
>         /* no more parents..stop recursion */
> -       if (net_dev->iflink == net_dev->ifindex)
> +       if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex)
>                 return false;
> 
>         /* recurse over the parent device */

Right, I think this is the correct fix.
Please do a proper patch submission for this.

I wondered why this issue does not show up with ipv6 tunnels
and it appears to be a bug :)

When a ipv6 tunnel interface is created, ip6_tnl_create2()
calls ip6_tnl_dev_init() which calls ip6_tnl_link_config().
ip6_tnl_link_config() sets dev->iflink.

Then register_netdev() overwrites this setting with
dev->iflink = dev->ifindex.

The output of the 'ip a' command looks like this:


9: ip6tnl0: <NOARP> mtu 1452 qdisc noop state DOWN                              
    link/tunnel6 :: brd ::
11: ip6tunnel1: <POINTOPOINT,NOARP> mtu 1452 qdisc noop state DOWN              
    link/tunnel6 2001:470:1f00:ffff::191 peer 2001:470:1f00:ffff::189


When I change to avoid the overwriting of dev->iflink it looks
like this:

9: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN                         
    link/tunnel6 :: brd :: 
12: ip6tunnel1@eth0: <POINTOPOINT,NOARP> mtu 1452 qdisc noop state DOWN         
    link/tunnel6 2001:470:1f00:ffff::191 peer 2001:470:1f00:ffff::189

So I think dev->iflink should be set in the ndo_init() function
of the tunnel, then register_netdev() leaves dev->iflink alone.

Thoughts, comments?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index b851cc5..fbda6b5 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -83,7 +83,7 @@  static bool batadv_is_on_batman_iface(const struct
net_device *net_dev)
                return true;

        /* no more parents..stop recursion */
-       if (net_dev->iflink == net_dev->ifindex)
+       if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex)
                return false;