lkml.org 
[lkml]   [2019]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 23/35] batman-adv: Avoid WARN on net_device without parent in netns
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Sven Eckelmann <sven@narfation.org>

    commit 955d3411a17f590364238bd0d3329b61f20c1cd2 upstream.

    It is not allowed to use WARN* helpers on potential incorrect input from
    the user or transient problems because systems configured as panic_on_warn
    will reboot due to such a problem.

    A NULL return value of __dev_get_by_index can be caused by various problems
    which can either be related to the system configuration or problems
    (incorrectly returned network namespaces) in other (virtual) net_device
    drivers. batman-adv should not cause a (harmful) WARN in this situation and
    instead only report it via a simple message.

    Fixes: b7eddd0b3950 ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
    Reported-by: syzbot+c764de0fcfadca9a8595@syzkaller.appspotmail.com
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    net/batman-adv/hard-interface.c | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)

    --- a/net/batman-adv/hard-interface.c
    +++ b/net/batman-adv/hard-interface.c
    @@ -19,7 +19,6 @@
    #include "main.h"

    #include <linux/atomic.h>
    -#include <linux/bug.h>
    #include <linux/byteorder/generic.h>
    #include <linux/errno.h>
    #include <linux/fs.h>
    @@ -172,8 +171,10 @@ static bool batadv_is_on_batman_iface(co
    parent_dev = __dev_get_by_index((struct net *)parent_net,
    dev_get_iflink(net_dev));
    /* if we got a NULL parent_dev there is something broken.. */
    - if (WARN(!parent_dev, "Cannot find parent device"))
    + if (!parent_dev) {
    + pr_err("Cannot find parent device\n");
    return false;
    + }

    if (batadv_mutual_parents(net_dev, net, parent_dev, parent_net))
    return false;

    \
     
     \ /
      Last update: 2019-02-13 19:42    [W:4.606 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site