Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2336426ybz; Thu, 23 Apr 2020 16:15:53 -0700 (PDT) X-Google-Smtp-Source: APiQypIDM4Y1GXaWtzz2D7kXnIPzzFoPBMDO6D7ajpI50EeTa2cT0ooyB2JTPJqNsiNgyhnW2PE9 X-Received: by 2002:a05:6402:b99:: with SMTP id cf25mr4856188edb.372.1587683753253; Thu, 23 Apr 2020 16:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683753; cv=none; d=google.com; s=arc-20160816; b=fSLIW/Bg9sNga99O2vpLBjHVum4OY2yKVoCsWK29CVZ2Snr71XczvG3F0ZCmy811KK E/FBZutqf/q7TfRbvNj8HVxxhsPdXX6PbEJ60p8gFRzT6WndOkwTwmWcm1DH16Ym2utH mzTKSTdzs80imz5K6Y9I0McegbrMR2itKmD+ayiZUwdR7H7URmrMp3oF4chGQ0/gFJ+Y pP/tzT9mG2Z7OrtHiIgvBlAr1G1CDEdgaO2bB8djxox08CcI1XhmYngP5MZrLhHrTvJu s1eXJWL4Kh1T9iDHzWwNj0gTHHa5eSLY6o+HZ762a57Ja5KT/bMgPJsNNajaF79/cz9o VNKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=jl9I4H6UEOqxsD4EsIf6AV7kbrg0OiSiB4eNCDvV/QY=; b=E8T3X9pAnxSpUe4XpPyfHdAJhOn5cY/ZjC0Hf7XWVobs/dCSw4s+GDJVIrfym7L0e6 EhDw8se/9E/8ysWerb7KuXV2I9ywTlwY3dhoaqpZz0sHtDkNyiGOUOitSxC6jmum/Wui 1vs/H4sXzdMrU5Ms4MO5qRBkQv8Akm+qTs+UXsYBp0NhRNLuDaaxt4qAVana/5KDpECv 5dLT96vl7RTC63E1jjdWg0pcmhHKMzJPbDD9tU685rqkMFOFMw7Epo8N1/Pt4PTk/Op7 +dyaLIzprVkdBK0EMJqi/KvJLQNqkEdAMJJrG0k2GGy375AmwpbbzXjUe/ncDTsMfL2u tryQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si2087893ejk.202.2020.04.23.16.15.29; Thu, 23 Apr 2020 16:15:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728667AbgDWXLG (ORCPT + 99 others); Thu, 23 Apr 2020 19:11:06 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50200 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728542AbgDWXGw (ORCPT ); Thu, 23 Apr 2020 19:06:52 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvb-0004mB-0n; Fri, 24 Apr 2020 00:06:43 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvX-00E6x9-1z; Fri, 24 Apr 2020 00:06:39 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Matteo Croce" , "Eric Dumazet" , "Jurgen Van Ham" , "David S. Miller" Date: Fri, 24 Apr 2020 00:06:57 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 190/245] macvlan: use skb_reset_mac_header() in macvlan_queue_xmit() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 1712b2fff8c682d145c7889d2290696647d82dab upstream. I missed the fact that macvlan_broadcast() can be used both in RX and TX. skb_eth_hdr() makes only sense in TX paths, so we can not use it blindly in macvlan_broadcast() Fixes: 96cc4b69581d ("macvlan: do not assume mac_header is set in macvlan_broadcast()") Signed-off-by: Eric Dumazet Reported-by: Jurgen Van Ham Tested-by: Matteo Croce Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- drivers/net/macvlan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -162,7 +162,7 @@ static void macvlan_broadcast(struct sk_ struct net_device *src, enum macvlan_mode mode) { - const struct ethhdr *eth = skb_eth_hdr(skb); + const struct ethhdr *eth = eth_hdr(skb); const struct macvlan_dev *vlan; struct sk_buff *nskb; unsigned int i; @@ -345,10 +345,11 @@ static int macvlan_queue_xmit(struct sk_ const struct macvlan_dev *dest; if (vlan->mode == MACVLAN_MODE_BRIDGE) { - const struct ethhdr *eth = (void *)skb->data; + const struct ethhdr *eth = skb_eth_hdr(skb); /* send to other bridge ports directly */ if (is_multicast_ether_addr(eth->h_dest)) { + skb_reset_mac_header(skb); macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); goto xmit_world; }