batman-adv: Merge bugfixes from 2019.0 442/head
authorSven Eckelmann <sven@narfation.org>
Wed, 16 Jan 2019 08:41:28 +0000 (09:41 +0100)
committerSven Eckelmann <sven@narfation.org>
Wed, 16 Jan 2019 08:45:07 +0000 (09:45 +0100)
* Avoid WARN on net_device without parent in netns
* Force mac header to start of data on xmit

Signed-off-by: Sven Eckelmann <sven@narfation.org>
batman-adv/Makefile
batman-adv/patches/0022-batman-adv-Avoid-WARN-on-net_device-without-parent-i.patch [new file with mode: 0644]
batman-adv/patches/0023-batman-adv-Force-mac-header-to-start-of-data-on-xmit.patch [new file with mode: 0644]

index 69e800a85f9a76addc37b04553ad2f062060d634..74ef4b85054191cd04be80ea5dbe8fdd14ac3d70 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=batman-adv
 
 PKG_VERSION:=2018.1
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 PKG_HASH:=b866b28dbbe5c9238abbdf5abbc30fc526dea56898ce4c1bd76d5c017843048b
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/batman-adv/patches/0022-batman-adv-Avoid-WARN-on-net_device-without-parent-i.patch b/batman-adv/patches/0022-batman-adv-Avoid-WARN-on-net_device-without-parent-i.patch
new file mode 100644 (file)
index 0000000..4850a55
--- /dev/null
@@ -0,0 +1,48 @@
+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
+
+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 <dvyukov@google.com>
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/59ad04405be86f648fd83d81d2fd0a78f215a43b
+---
+ 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 2f0d42f2f913e74cf10c0c6ce89320434994cac5..08690d06b7be2b25ca3f009394763c7083c70644 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;
diff --git a/batman-adv/patches/0023-batman-adv-Force-mac-header-to-start-of-data-on-xmit.patch b/batman-adv/patches/0023-batman-adv-Force-mac-header-to-start-of-data-on-xmit.patch
new file mode 100644 (file)
index 0000000..c5eb7dd
--- /dev/null
@@ -0,0 +1,39 @@
+From: Sven Eckelmann <sven@narfation.org>
+Date: Mon, 31 Dec 2018 22:46:09 +0100
+Subject: [PATCH] batman-adv: Force mac header to start of data on xmit
+
+The caller of ndo_start_xmit may not already have called
+skb_reset_mac_header. The returned value of skb_mac_header/eth_hdr
+therefore can be in the wrong position and even outside the current skbuff.
+This for example happens when the user binds to the device using a
+PF_PACKET-SOCK_RAW with enabled qdisc-bypass:
+
+  int opt = 4;
+  setsockopt(sock, SOL_PACKET, PACKET_QDISC_BYPASS, &opt, sizeof(opt));
+
+Since eth_hdr is used all over the codebase, the batadv_interface_tx
+function must always take care of resetting it.
+
+Fixes: fe28a94c01e1 ("batman-adv: receive packets directly using skbs")
+Reported-by: syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com
+Reported-by: syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com
+Signed-off-by: Sven Eckelmann <sven@narfation.org>
+
+Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/74c4b0c50f19f986752ee18ed393732f4eed7a66
+---
+ net/batman-adv/soft-interface.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
+index 79d6ab78359db9c6a5df14e2e204c611ab134dfc..d3f540ba2a1388a8aa693a539d01d6a1cad95b44 100644
+--- a/net/batman-adv/soft-interface.c
++++ b/net/batman-adv/soft-interface.c
+@@ -221,6 +221,8 @@ static int batadv_interface_tx(struct sk_buff *skb,
+       netif_trans_update(soft_iface);
+       vid = batadv_get_vid(skb, 0);
++
++      skb_reset_mac_header(skb);
+       ethhdr = eth_hdr(skb);
+       switch (ntohs(ethhdr->h_proto)) {