From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 897E5C43381 for ; Mon, 18 Feb 2019 14:21:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4037021901 for ; Mon, 18 Feb 2019 14:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550499707; bh=F0pqhsQ483fJrpLdXVr6//UsoJmm4McLIOkAi7DwvJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GeqMnyTe0k/SRi69QdovlnlJwlVN8mSnMWPvV97IEQf4H0jReDp0lgwxnh/vLYOxU y3Xaa+pJF38+BWwq8myb63cn3SIl0kgQUORbaSRnOlEImWPKayjbVDaQ4kh0Y5tk71 tOqunEpLAcHmdMEl++XJkWzR3/CjcOTCH0/YuQvk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390557AbfBROVp (ORCPT ); Mon, 18 Feb 2019 09:21:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:49352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390354AbfBROGR (ORCPT ); Mon, 18 Feb 2019 09:06:17 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F5F12195D; Mon, 18 Feb 2019 14:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498777; bh=F0pqhsQ483fJrpLdXVr6//UsoJmm4McLIOkAi7DwvJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+NSqbPGzf2Q5YIYMrdDQckUVe+pTdN2X1hoOeAdAauCm0zP1YCPv12dNwMWRa+99 /sp4RmGz2zxNsagOpouJ7msdgcTpbYHhaMx22mSOhN+laLEKkUNBPpTVhy28eQPd5u Tp3s8FtwvAKH9EnmJ3lLTSDz5mZsxD4uQUq4i1hc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com, syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com, Sven Eckelmann , Simon Wunderlich Subject: [PATCH 4.4 117/143] batman-adv: Force mac header to start of data on xmit Date: Mon, 18 Feb 2019 14:44:05 +0100 Message-Id: <20190218133533.287374255@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133529.099444112@linuxfoundation.org> References: <20190218133529.099444112@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit 9114daa825fc3f335f9bea3313ce667090187280 upstream. 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: c6c8fea29769 ("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 Signed-off-by: Simon Wunderlich Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/soft-interface.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -209,6 +209,8 @@ static int batadv_interface_tx(struct sk soft_iface->trans_start = jiffies; vid = batadv_get_vid(skb, 0); + + skb_reset_mac_header(skb); ethhdr = eth_hdr(skb); switch (ntohs(ethhdr->h_proto)) {