Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2293643imc; Tue, 12 Mar 2019 10:45:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFCIWdl5k9lhG3ps0hVd5hZzaow9NehpmuAtHWNUlMEtOtYb5/+UJmf15vSRt+YUiR0q57 X-Received: by 2002:a62:5687:: with SMTP id h7mr39706666pfj.198.1552412740269; Tue, 12 Mar 2019 10:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552412740; cv=none; d=google.com; s=arc-20160816; b=Depi6MaxNBxALwHgvTYhcDFYuMmOvKZXd+ZAOE3AZcNRdLQi0MbNEtyPwI/CmtIDU4 zhM4bdqBam4OfKSGVGBP9BxAorBeMwd90LC7Fe7P+myfZjvm3msyPP3vRUjaudH2Nf9g Z3kSz0c4amjo+6k0a4xiF+XYXdWAzIgWUbgmS4am6uroMSdQxv0bRYx1hs96Dw14yX4Q Oaf0d0ekJNUR8YaMaS+uDbYJrG7kbXk+J9aydNGY8N4EtPk7+4cWRPo9nx/pkZI6v6t5 FrwoT+H+rGGvTO7KFE1aoUPi2rliBa9Mxw+PgqbFQrkeMzM2N7ZCMwYndIv7YLwQnY8H nNag== 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=rBgWdqERaltksiFIcObrh0eEUd4sjO3/e1213Y2qrd8=; b=SQZCQDuJEP2UDTInIQYXZzPF3RaphheKlUE2siQqUp3OspmTDldPna7Obrp0AFuAzO Pube2n0SCxFMvvEajppc75BF1W4jOWwiv8/PMwmUshLyXNIExmNdvTKtZcCj2p+n8J1t 053BnjlWEW1M0VXHd9o3SB0Zb3+rWcqs8PHg5PlYxCUl97/6yr5vvf5vp1Pk12bEoKoe T7n2xZbtsePuIILQSYSpYbfavLVF0haYZQKAoiaNY0QieN3fG2tsPYopFXfrQDK1pyB3 6G6IDiieVHDWxF/xIz3ITTd21QAUQQQtZYo1mhnehXrHtvzDKAqWOkHIoyZs8OFGwJNH qcjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O46YTHsF; 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 70si9111439ple.294.2019.03.12.10.45.24; Tue, 12 Mar 2019 10:45: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=O46YTHsF; 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 S1728976AbfCLRoe (ORCPT + 99 others); Tue, 12 Mar 2019 13:44:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:56582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728830AbfCLRPk (ORCPT ); Tue, 12 Mar 2019 13:15:40 -0400 Received: from localhost (unknown [104.133.8.98]) (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 952102087C; Tue, 12 Mar 2019 17:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552410939; bh=GmmWS9IFe54Z+hx2nhaFV0JSrTVHNaGDx4sv7k9qwns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O46YTHsFQuYICyW3B7jzCcTz/bFK5C2rGnxjiN5EUNEbK98lSCLzkMMCGmIIwXrxR l573yuXFKlE327S6T1XvoBZXqb38wUfkfq72NNbLwaQkCYQX69se2PfSbotFYFLZaU FK5oKjFPO/vi2lz5QLlJuUo0Guj0GTH6NEE2u1Ik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haiyang Zhang , "David S. Miller" Subject: [PATCH 4.14 016/135] hv_netvsc: Fix IP header checksum for coalesced packets Date: Tue, 12 Mar 2019 10:07:43 -0700 Message-Id: <20190312170342.605281119@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312170341.127810985@linuxfoundation.org> References: <20190312170341.127810985@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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haiyang Zhang [ Upstream commit bf48648d650db1146b75b9bd358502431e86cf4f ] Incoming packets may have IP header checksum verified by the host. They may not have IP header checksum computed after coalescing. This patch re-compute the checksum when necessary, otherwise the packets may be dropped, because Linux network stack always checks it. Signed-off-by: Haiyang Zhang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/netvsc_drv.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -741,6 +741,14 @@ void netvsc_linkstatus_callback(struct h schedule_delayed_work(&ndev_ctx->dwork, 0); } +static void netvsc_comp_ipcsum(struct sk_buff *skb) +{ + struct iphdr *iph = (struct iphdr *)skb->data; + + iph->check = 0; + iph->check = ip_fast_csum(iph, iph->ihl); +} + static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, struct napi_struct *napi, const struct ndis_tcp_ip_checksum_info *csum_info, @@ -764,9 +772,17 @@ static struct sk_buff *netvsc_alloc_recv /* skb is already created with CHECKSUM_NONE */ skb_checksum_none_assert(skb); - /* - * In Linux, the IP checksum is always checked. - * Do L4 checksum offload if enabled and present. + /* Incoming packets may have IP header checksum verified by the host. + * They may not have IP header checksum computed after coalescing. + * We compute it here if the flags are set, because on Linux, the IP + * checksum is always checked. + */ + if (csum_info && csum_info->receive.ip_checksum_value_invalid && + csum_info->receive.ip_checksum_succeeded && + skb->protocol == htons(ETH_P_IP)) + netvsc_comp_ipcsum(skb); + + /* Do L4 checksum offload if enabled and present. */ if (csum_info && (net->features & NETIF_F_RXCSUM)) { if (csum_info->receive.tcp_checksum_succeeded ||