Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-15 10:23:48 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-15 10:24:17 +0100
commit25b689e914e74318b9a11a6d64d87743fcab8e93 (patch)
tree3b916ba89c62e4a9961b0d07adda9fc196887ec9
parent7a25d425a420b54f2fceb70db7547808b652423c (diff)
batman-adv: Avoid WARN on net_device without parent in netns
-rw-r--r--patches.kernel.org/4.20.9-049-batman-adv-Avoid-WARN-on-net_device-without-pa.patch57
-rw-r--r--series.conf1
2 files changed, 58 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.9-049-batman-adv-Avoid-WARN-on-net_device-without-pa.patch b/patches.kernel.org/4.20.9-049-batman-adv-Avoid-WARN-on-net_device-without-pa.patch
new file mode 100644
index 0000000000..70463d589f
--- /dev/null
+++ b/patches.kernel.org/4.20.9-049-batman-adv-Avoid-WARN-on-net_device-without-pa.patch
@@ -0,0 +1,57 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Sun, 30 Dec 2018 12:46:01 +0100
+Subject: [PATCH] batman-adv: Avoid WARN on net_device without parent in netns
+References: bnc#1012628
+Patch-mainline: 4.20.9
+Git-commit: 955d3411a17f590364238bd0d3329b61f20c1cd2
+
+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>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ 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 781c5b6e6e8e..41be60d54001 100644
+--- a/net/batman-adv/hard-interface.c
++++ b/net/batman-adv/hard-interface.c
+@@ -20,7 +20,6 @@
+ #include "main.h"
+
+ #include <linux/atomic.h>
+-#include <linux/bug.h>
+ #include <linux/byteorder/generic.h>
+ #include <linux/errno.h>
+ #include <linux/gfp.h>
+@@ -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;
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 8aaa420f6e..31e37e9d65 100644
--- a/series.conf
+++ b/series.conf
@@ -1131,6 +1131,7 @@
patches.kernel.org/4.20.9-046-Revert-ext4-use-ext4_write_inode-when-fsyncing.patch
patches.kernel.org/4.20.9-047-libceph-avoid-KEEPALIVE_PENDING-races-in-ceph_.patch
patches.kernel.org/4.20.9-048-xfrm-refine-validation-of-template-and-selecto.patch
+ patches.kernel.org/4.20.9-049-batman-adv-Avoid-WARN-on-net_device-without-pa.patch
########################################################
# Build fixes that apply to the vanilla kernel too.