Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5845224ybn; Sun, 29 Sep 2019 06:59:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqw70PB4QEJIPLKd3mtBUGEAUXnw2/nBW+KE95Yx21CaPH42j+v08OwEtET5FrIkjR+rerZf X-Received: by 2002:a50:a8a2:: with SMTP id k31mr14498455edc.79.1569765580965; Sun, 29 Sep 2019 06:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569765580; cv=none; d=google.com; s=arc-20160816; b=ZuBWQb4vur3lpixeYwihtJrXbJ8mTkEaVoIbowwWb1ftoBSifPbkm/r6MpHsVKLR6o io0foxX2eFbtIgWby9xdMlXLe58fgsURKSmTi5njMC+AGNYsQTj2Ag60x47SWqnizkIy tLwrmpx9/gXFPV+9T/RP8eRdS++b/HNNRJvQeL53eGG4aATX7iKmFRRDHQazDPFs6E+h CQMth04JG4Q3TnsK+tRCbDyGp7rNHeTocxPGLJ5CdpBRH1mv9FB/YuHzo5vHj+fWMseF NOIlJiYfH3LXEQz0PA/st5CJ66E2GhDqL2YU+YcMAi9k1IcYx/+qoD29q4/l+sBPm2Lt cxig== 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=MLgYTloIBqCkASSuIKdg/b/jYuAOM1HfM1gATOKMaIs=; b=o/amnhjKb5TY2smVaisM1/i71fxrGg+O5gGorpDVBhRy5mgh0U4KCBfgR7ptpXJL1p qlJgqJ4MGntB19RFayqNqLDpsImderAKN2yzHiNmuGMVjPFCojsqcuVyF/2YgKS39y1+ GcIumIKrWK2euH8qTY5lmLdnpBRUhmZiGeZdHoHRGMMK4mpF0q0D4/VPky3CEoPwKVgf JM7gRdQlfzWEgTQEQPAjs1hD63WiX6bh6vHlVI6ryJ6K0/yFd6M+vMnuvZip3Gp8ZuNQ 6iE+3OiFCIzpPzMRnRruc7N6DdxGHxvDPeMB/gGQxBdwccixYbL3DhXqj8J+deDXtkUK LMQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hEGO8ghv; 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 d24si5314051ede.119.2019.09.29.06.59.16; Sun, 29 Sep 2019 06:59:40 -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=hEGO8ghv; 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 S1729396AbfI2N6E (ORCPT + 99 others); Sun, 29 Sep 2019 09:58:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:38540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729294AbfI2N6D (ORCPT ); Sun, 29 Sep 2019 09:58:03 -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 9F40A21882; Sun, 29 Sep 2019 13:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765482; bh=4OUpF6soZwSpSA/Bi5kTX+rRqC5xgUKzEdUIw5cqoFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hEGO8ghveRBVaVta0en7Eh+5DUnreEVRUXSMD2/WIchr+NS/OWIdwVj743IM1v2PS EEArYNZHqrOvE+uxLQeBT/15LqyS6G7PL+DgzM6bWhUuUlaHowLFcA6WG+0h8tBc4j iMe/MYC3KR97FU3woJcXv0X2LazItvSUjUdzYINs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alaa Hleihel , Or Gerlitz , Saeed Mahameed , Cong Wang , Tariq Toukan , "David S. Miller" Subject: [PATCH 4.19 17/63] mlx5: fix get_ip_proto() Date: Sun, 29 Sep 2019 15:53:50 +0200 Message-Id: <20190929135035.269253760@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190929135031.382429403@linuxfoundation.org> References: <20190929135031.382429403@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: Cong Wang [ Upstream commit ef6fcd455278c2be3032a346cc66d9dd9866b787 ] IP header is not necessarily located right after struct ethhdr, there could be multiple 802.1Q headers in between, this is why we call __vlan_get_protocol(). Fixes: fe1dc069990c ("net/mlx5e: don't set CHECKSUM_COMPLETE on SCTP packets") Cc: Alaa Hleihel Cc: Or Gerlitz Cc: Saeed Mahameed Signed-off-by: Cong Wang Reviewed-by: Tariq Toukan Acked-by: Saeed Mahameed Signed-off-by: David S. Miller Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -725,9 +725,9 @@ static u32 mlx5e_get_fcs(const struct sk return __get_unaligned_cpu32(fcs_bytes); } -static u8 get_ip_proto(struct sk_buff *skb, __be16 proto) +static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) { - void *ip_p = skb->data + sizeof(struct ethhdr); + void *ip_p = skb->data + network_depth; return (proto == htons(ETH_P_IP)) ? ((struct iphdr *)ip_p)->protocol : ((struct ipv6hdr *)ip_p)->nexthdr; @@ -766,7 +766,7 @@ static inline void mlx5e_handle_csum(str goto csum_unnecessary; if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { - if (unlikely(get_ip_proto(skb, proto) == IPPROTO_SCTP)) + if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) goto csum_unnecessary; skb->ip_summed = CHECKSUM_COMPLETE;