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 1D460C43381 for ; Mon, 18 Feb 2019 14:15:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D672E2177E for ; Mon, 18 Feb 2019 14:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550499312; bh=WpLiRP04nUsiTYecTGkkLjX48wMr0FEPk3/Kg3TsO0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SwfgqH/LtF5/zYMhXMNgMU9UjI/qGTcGxJvmDHEziHlIhyXrSSobdX5tSobuqYARN 2FmVOrP9Wu2uySGA2v7T3YPn8dYn615uVBo5x0NrI8l/U/YueDU6JK0/hMLCr+BPiY 6cgO1bNyj3+gLg15iH2NJ9Rn+404JAZKClsiUI/8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392033AbfBROMV (ORCPT ); Mon, 18 Feb 2019 09:12:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:56812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391418AbfBROMT (ORCPT ); Mon, 18 Feb 2019 09:12:19 -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 2017C218AD; Mon, 18 Feb 2019 14:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550499138; bh=WpLiRP04nUsiTYecTGkkLjX48wMr0FEPk3/Kg3TsO0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhI/NKIcM31ZFRXHwwFIR6Yzdnsqcx/ekHihPutmq6A917SdPtv5C06OdcZ6P+OIG GfLayAO0VSetaxCH68rMfvI33fQBUaxOAeDvbtICHj8kNGinQI3V+AHZCHkIuLS/Yg L6QOE9F6fVTMS05m/72VztGccrmSzxFk+c6tOFo8= 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 3.18 089/108] batman-adv: Force mac header to start of data on xmit Date: Mon, 18 Feb 2019 14:44:25 +0100 Message-Id: <20190218133523.691858954@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133519.525507231@linuxfoundation.org> References: <20190218133519.525507231@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 3.18-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 @@ -180,6 +180,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)) {