batman-adv: Refresh patches
[feed/routing.git] / batman-adv / patches / 0023-batman-adv-Force-mac-header-to-start-of-data-on-xmit.patch
1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Mon, 31 Dec 2018 22:46:09 +0100
3 Subject: batman-adv: Force mac header to start of data on xmit
4
5 The caller of ndo_start_xmit may not already have called
6 skb_reset_mac_header. The returned value of skb_mac_header/eth_hdr
7 therefore can be in the wrong position and even outside the current skbuff.
8 This for example happens when the user binds to the device using a
9 PF_PACKET-SOCK_RAW with enabled qdisc-bypass:
10
11 int opt = 4;
12 setsockopt(sock, SOL_PACKET, PACKET_QDISC_BYPASS, &opt, sizeof(opt));
13
14 Since eth_hdr is used all over the codebase, the batadv_interface_tx
15 function must always take care of resetting it.
16
17 Fixes: fe28a94c01e1 ("batman-adv: receive packets directly using skbs")
18 Reported-by: syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com
19 Reported-by: syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com
20 Signed-off-by: Sven Eckelmann <sven@narfation.org>
21
22 Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/74c4b0c50f19f986752ee18ed393732f4eed7a66
23
24 diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
25 index 79d6ab78359db9c6a5df14e2e204c611ab134dfc..d3f540ba2a1388a8aa693a539d01d6a1cad95b44 100644
26 --- a/net/batman-adv/soft-interface.c
27 +++ b/net/batman-adv/soft-interface.c
28 @@ -221,6 +221,8 @@ static int batadv_interface_tx(struct sk_buff *skb,
29
30 netif_trans_update(soft_iface);
31 vid = batadv_get_vid(skb, 0);
32 +
33 + skb_reset_mac_header(skb);
34 ethhdr = eth_hdr(skb);
35
36 switch (ntohs(ethhdr->h_proto)) {