]> git.baikalelectronics.ru Git - kernel.git/commit
batman-adv: Force mac header to start of data on xmit
authorSven Eckelmann <sven@narfation.org>
Mon, 31 Dec 2018 21:31:01 +0000 (22:31 +0100)
committerSimon Wunderlich <sw@simonwunderlich.de>
Mon, 31 Dec 2018 21:47:50 +0000 (22:47 +0100)
commit501955e58103529c41353f148b5edac9e7398a7b
treeb654907c8a71f008fb919c28fdef4e9c4fec8422
parent58f24b02eea20d67c4a5dc97458f5bb98d6581db
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: b01d4991e36e ("net: Add batman-adv meshing protocol")
Reported-by: syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com
Reported-by: syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/soft-interface.c