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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 AC8EDC4332E for ; Thu, 19 Mar 2020 13:33:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73501207FC for ; Thu, 19 Mar 2020 13:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584624793; bh=vV01+2S7qPyedViSZzQlN5nnOmIOcHvFFGZq5R3HxyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Cs+78hgT7W+PY307JCN5d8A0BgJWunuTSoyq2UnPOTWzab7LNtPPaAhATbzMgvPIn jZPL6JfdJCxJidxAXbMZPuwdPiW+psbJ75oDMQhj+rG22Z9YXCZffgFO6rAVMSyFcg biWcHTKRIKRjh51gnXZWAK1QX/iEYRRd5k3bQlHg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728767AbgCSNOR (ORCPT ); Thu, 19 Mar 2020 09:14:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:33494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727641AbgCSNOM (ORCPT ); Thu, 19 Mar 2020 09:14:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 9741820722; Thu, 19 Mar 2020 13:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584623652; bh=vV01+2S7qPyedViSZzQlN5nnOmIOcHvFFGZq5R3HxyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mCdiFTrz4NfWUWCSSQ8mouHfJOxs9o6Y4/3tOj+IqGMNA7GuaZoJMR4iuzU4t+M6F EfmyNTSMzrXuj4E2bu6hAjfUiW2RLtoWmWc7GTTWccmQzscp1QUoSASMo1xUc+8LA0 0LfvFF/71/Jj2MQV2QPhdp6d4h24lVnviGOchf/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Matthias Schiffer , Sven Eckelmann Subject: [PATCH 4.9 75/90] batman-adv: update data pointers after skb_cow() Date: Thu, 19 Mar 2020 14:00:37 +0100 Message-Id: <20200319123951.602545138@linuxfoundation.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200319123928.635114118@linuxfoundation.org> References: <20200319123928.635114118@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Matthias Schiffer commit bc44b78157f621ff2a2618fe287a827bcb094ac4 upstream. batadv_check_unicast_ttvn() calls skb_cow(), so pointers into the SKB data must be (re)set after calling it. The ethhdr variable is dropped altogether. Fixes: 78fc6bbe0aca ("batman-adv: add UNICAST_4ADDR packet type") Signed-off-by: Matthias Schiffer Signed-off-by: Sven Eckelmann Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/routing.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -930,7 +930,6 @@ int batadv_recv_unicast_packet(struct sk bool is4addr; unicast_packet = (struct batadv_unicast_packet *)skb->data; - unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; is4addr = unicast_packet->packet_type == BATADV_UNICAST_4ADDR; /* the caller function should have already pulled 2 bytes */ @@ -951,9 +950,13 @@ int batadv_recv_unicast_packet(struct sk if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size)) return NET_RX_DROP; + unicast_packet = (struct batadv_unicast_packet *)skb->data; + /* packet for me */ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { if (is4addr) { + unicast_4addr_packet = + (struct batadv_unicast_4addr_packet *)skb->data; subtype = unicast_4addr_packet->subtype; batadv_dat_inc_counter(bat_priv, subtype);