Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5066912pxb; Mon, 15 Feb 2021 08:38:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIxuA8GL1nIRz+dd/55VapSalUPRNTdhO1pe192xWcjCz0Xns2K1hHkktC01NHFbhha92i X-Received: by 2002:a17:907:2d10:: with SMTP id gs16mr16573633ejc.0.1613407093070; Mon, 15 Feb 2021 08:38:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407093; cv=none; d=google.com; s=arc-20160816; b=SeJRf7NNzZan9y++Um1AyTobwwJ+mDHTijjZy7DR1C0iXY2INeE7jydS2iKWbn1Eg/ vPtw4R8GpTdScYCRXsx/QbiSEWtWMMrMsQad6hipBP9hf1+4WDheN/6m5kI8BYMfbSgd rfiZiRzNMJhRpiUXU3cUACfskWARbSuid/Kx4JzHgs0tU2nrGQI0+quCp18aU3kVmuvT eD/JIizz4PolxUCbxVcwVJ3/0TtcClpllcjSCRR9srV20qWsKIFHLErUpPNiTMe9/Wd0 6uQjAgYC+fwQVz2BM6Y6NtKGCydZzJkPa+iTW2nWb36DSkFE5mIuPZzHbdkj/0sywoLU KNLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F/Fec0m7uDNkEBR7IFNEzZLp9u6PFDc6vdlTP7VSUsY=; b=PQgK4t8UAD6y6O4J6JPBCo11cnyGD7pl9oFjssvRmLrEI1ZstT49m1Y9jIAQ810Kov QQmTrGHy1hOQN6iR+oVqQpJmzstIuqiwWfvcMrrGqVicrW9f2r8B7WIcIovm5nAIavT2 epzLjRiB7ixU9W+SJxvplbnrWw/hoVDojESHxSh461LsauYeZHvwC/0/is0C8XNvj5F7 w4utYsvTkLUDfytcGT5NVNWVeynHY6ado81hJSdBbdogRYa/1EZxjjDJboQuYG9GXX17 LCqqM5hx/MheuAJex21tl/Il2cBVEqxbA836VoaF92+ESlyAZBN339xHjWRMBec9iet/ foAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S2I6YIcb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si1423218edr.439.2021.02.15.08.37.49; Mon, 15 Feb 2021 08:38:13 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S2I6YIcb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbhBOQhD (ORCPT + 99 others); Mon, 15 Feb 2021 11:37:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:49636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231479AbhBOPhu (ORCPT ); Mon, 15 Feb 2021 10:37:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9405064EA7; Mon, 15 Feb 2021 15:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403197; bh=GZTzwpC31F6WXnAiRavxsqhcbOW5d1H/w3YO1vV4c5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2I6YIcbgcgMBron3e+IXN5hGGTXCaI7TJPM0nO0PaGIybGOSU8zua037wX7E8/r8 emAyP2e2bjVtjvtmTYFnyh8x0lG9VgmdxnUndXsGim4cLauOvTHZH+6S78mRjAZCwd IXJXWRIwr/Q0sUFRCtgGaAerNti9eTFZnKTA8q9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juan Vazquez , "Andrea Parri (Microsoft)" , Jesse Brandeburg , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 064/104] hv_netvsc: Reset the RSC count if NVSP_STAT_FAIL in netvsc_receive() Date: Mon, 15 Feb 2021 16:27:17 +0100 Message-Id: <20210215152721.540604376@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrea Parri (Microsoft) [ Upstream commit 12bc8dfb83b5292fe387b795210018b7632ee08b ] Commit 44144185951a0f ("hv_netvsc: Add validation for untrusted Hyper-V values") added validation to rndis_filter_receive_data() (and rndis_filter_receive()) which introduced NVSP_STAT_FAIL-scenarios where the count is not updated/reset. Fix this omission, and prevent similar scenarios from occurring in the future. Reported-by: Juan Vazquez Signed-off-by: Andrea Parri (Microsoft) Fixes: 44144185951a0f ("hv_netvsc: Add validation for untrusted Hyper-V values") Reviewed-by: Jesse Brandeburg Link: https://lore.kernel.org/r/20210203113602.558916-1-parri.andrea@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/hyperv/netvsc.c | 5 ++++- drivers/net/hyperv/rndis_filter.c | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 0c3de94b51787..6a7ab930ef70d 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1253,8 +1253,11 @@ static int netvsc_receive(struct net_device *ndev, ret = rndis_filter_receive(ndev, net_device, nvchan, data, buflen); - if (unlikely(ret != NVSP_STAT_SUCCESS)) + if (unlikely(ret != NVSP_STAT_SUCCESS)) { + /* Drop incomplete packet */ + nvchan->rsc.cnt = 0; status = NVSP_STAT_FAIL; + } } enq_receive_complete(ndev, net_device, q_idx, diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index b22e47bcfeca1..90bc0008fa2fd 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -508,8 +508,6 @@ static int rndis_filter_receive_data(struct net_device *ndev, return ret; drop: - /* Drop incomplete packet */ - nvchan->rsc.cnt = 0; return NVSP_STAT_FAIL; } -- 2.27.0