From patchwork Sun Dec 30 11:46:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17720 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 8C19381398; Sun, 30 Dec 2018 12:46:29 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="zYN8sVVP"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 2208580729 for ; Sun, 30 Dec 2018 12:46:26 +0100 (CET) Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a02:2454:8871:1700:6a17:29ff:fee0:e6ec]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 19F1E1100E2; Sun, 30 Dec 2018 12:46:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1546170386; bh=pf1hoFAW4hyZTaz0tQYPZM1QVxC5mr8qpMRCIVsicgA=; h=From:To:Cc:Subject:Date:From; b=zYN8sVVPhcdDyLwgEz/5+ePzKBGthkcA06avezP2mTgzVFM8FZMy7owRTh1QB1hr1 MRSFWrs07L5KHGqGIU8B4cIMIArihGyPKMLk4rJIV8f1R24MafYpx7m5r72QkaFEp9 xAJ7pLb61VA8l52JzUSt4fqW5rd9MCP9llWseXSQ= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 30 Dec 2018 12:46:01 +0100 Message-Id: <20181230114601.3546-1-sven@narfation.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: Avoid WARN on net_device without parent in netns X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: syzkaller-bugs@googlegroups.com, Dmitry Vyukov , syzbot Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" 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: 3d48811b27f5 ("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 Signed-off-by: Sven Eckelmann --- Cc: syzbot Cc: Dmitry Vyukov Cc: syzkaller-bugs@googlegroups.com --- net/batman-adv/hard-interface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 508f4416..5b7632cf 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -20,7 +20,6 @@ #include "main.h" #include -#include #include #include #include @@ -179,8 +178,10 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) 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;