Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp658605ybg; Thu, 19 Mar 2020 06:32:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtRHzx/2iuCov7r9E49Q/lEhGS1i+ZJIT6UZDXzv+oaHqhS/XOhG+FlQ8BkY9nQ7+oNgHqh X-Received: by 2002:a9d:64d4:: with SMTP id n20mr2171289otl.193.1584624769012; Thu, 19 Mar 2020 06:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624769; cv=none; d=google.com; s=arc-20160816; b=FW28GeNKv61G9wvSH7eJ9Ojcpoa9g95Hkd+ehAuPQzkg8MYlK3xQ/NTM7yrj55L9LV zR2Etbz46AiC8IxTkDgEQXf2x6qevrI+q0VmCLFUMMHclOP8SnMQQxthd0c+SjQDJRWp ttB9cH57WM4+kkifmcRikdUzSo2bT7wl3bXrWRnhCyAzeOFzR4pcXWWQDpd5JVi6VOxR +CB4jVUswUnt/4j6hSpolFvoxFqSgQuW9Vry2+ytxUsxiNDUHlXFzSrMzcEIBXcTJ6pq v6tThY/5DQ6t4S1D6HCcwC9iSM8RiLlRcolc1ApJA1AcpxKE5qlT258t7aN6LP2wKQYE Zd+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bVZ12FlBoHARPGWGnhRPDCvVrcOXPzQ4+KgMcpPKit4=; b=y5zadAnzoslefvUOhV9ZZaDXDSDB6gUxiaimsxppWhFjQ/lAYNaAFLHigKi/cJxDci 0N+iuCJEeyZYQJXRDIqsagSEBXGGexbbf8EBjqOBCdo93qTow5+lvORYH36kJLhV+8e7 NcCLM+SSCe+cuuEEF8m4rLp42wCQSVE7VeGsqkaDdjlMcMe0EJ995eHEiWvGfiXAbhxv yr5an0RIzubZkt5CBbImP+svroNbWmdON+QWSr9RoGg5dCgaTfx6iS5uNRiqU93eS/x/ cDLOqmYpSHuEQ4OXwjDadfl5LTli+opOZ10//GFGHGlsDEpkwsJit0U6fy3i0sPpalG/ 2pqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="HRrEqI/K"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y123si1117354oia.141.2020.03.19.06.32.36; Thu, 19 Mar 2020 06:32:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="HRrEqI/K"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729808AbgCSNSr (ORCPT + 99 others); Thu, 19 Mar 2020 09:18:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:41350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729656AbgCSNSo (ORCPT ); Thu, 19 Mar 2020 09:18:44 -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 B3ED8206D7; Thu, 19 Mar 2020 13:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584623924; bh=/tnjJMgvLSGDranwiq8LtGIlbks4hqw1BrVjb+hbWMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRrEqI/KLvHuqxzfMyViKrQcHtT6zMbbChLhQCJYTxYqT0GqRhVwFxPbZDrypcxf5 F+eQA52esb+GXpJUgbh0cZM+QsOXZs23ayTxDbWBtDftcmjVm3DCsTB6D/6MWUMtkC aU3r266xpPqRJnxDA49Rncyl/NXAFhDrtJ5N73EE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Matthias Schiffer , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 4.14 72/99] batman-adv: update data pointers after skb_cow() Date: Thu, 19 Mar 2020 14:03:50 +0100 Message-Id: <20200319124003.112213376@linuxfoundation.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200319123941.630731708@linuxfoundation.org> References: <20200319123941.630731708@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: 7cdcf6dddc42 ("batman-adv: add UNICAST_4ADDR packet type") Signed-off-by: Matthias Schiffer Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/routing.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -950,14 +950,10 @@ int batadv_recv_unicast_packet(struct sk struct batadv_orig_node *orig_node = NULL, *orig_node_gw = NULL; int check, hdr_size = sizeof(*unicast_packet); enum batadv_subtype subtype; - struct ethhdr *ethhdr; int ret = NET_RX_DROP; bool is4addr, is_gw; unicast_packet = (struct batadv_unicast_packet *)skb->data; - unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; - ethhdr = eth_hdr(skb); - is4addr = unicast_packet->packet_type == BATADV_UNICAST_4ADDR; /* the caller function should have already pulled 2 bytes */ if (is4addr) @@ -977,12 +973,14 @@ int batadv_recv_unicast_packet(struct sk if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size)) goto free_skb; + unicast_packet = (struct batadv_unicast_packet *)skb->data; + /* packet for me */ if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { /* If this is a unicast packet from another backgone gw, * drop it. */ - orig_addr_gw = ethhdr->h_source; + orig_addr_gw = eth_hdr(skb)->h_source; orig_node_gw = batadv_orig_hash_find(bat_priv, orig_addr_gw); if (orig_node_gw) { is_gw = batadv_bla_is_backbone_gw(skb, orig_node_gw, @@ -997,6 +995,8 @@ int batadv_recv_unicast_packet(struct sk } if (is4addr) { + unicast_4addr_packet = + (struct batadv_unicast_4addr_packet *)skb->data; subtype = unicast_4addr_packet->subtype; batadv_dat_inc_counter(bat_priv, subtype);