Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9092456pxu; Mon, 28 Dec 2020 06:27:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJw010w2FOtYrxXyw/oH11fsULOCjt2HpTMC8vCdS9Z9MgTrAVlGSh98WiOWgudQfAaQxm/+ X-Received: by 2002:a17:906:39d5:: with SMTP id i21mr40394049eje.339.1609165641125; Mon, 28 Dec 2020 06:27:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165641; cv=none; d=google.com; s=arc-20160816; b=xH41FVE2X//TxZoW1zRjOf5EKEXGn7kKQeUyibD/lrPHXuy9myRD5iu7Zu9wt4SXP/ ms9y3AMHDEg9JaW2c83AXqU1MAQlwHhaYvU873B/KJKZ26Sw/lMoIp0j6v/RQMV1I9/U 4clkvbjtQsc3U/0j4KYVN2C3z8VMJxCbfM4GNp8X4nQFG2w1DIUoibEi98aE5UFsJi3n uTVlr6byso+B3AoA90Yr2vInuXLMxExO6nR62MvJukBYLwJQSoOrdI7bmDiq+vBy4ukK tLDnNwzmuZ3pGLAsmm2PzgY0Hdms+MSIHv2Q5YYGGNUvm0TXyoP3YMwHxr3wJeW0CcME hCCQ== 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=qmniQ4H6iYGKzM6RYE1uH1yBQBPgxqUHeCUXbzcq6DU=; b=ZnjS7mGiC9ESxagnCCXHAQVP6pqGq1pN36/ZgW6MUFUdNaiiPe906oktZ7NcdwvSOL L7TJWrhYpJkOAdamH2dOHc1L0e+RVXqlB4lv1kB82vR2Zu47Yd/X4XLeyN9UkfFQD/bQ vBJG0z8rNV0fj6EfpmL8T6wJnMeMQaavfi53mF1BNR4NFy/n3uB5SWg/0H+kT3WMN+ce u9uAv1BFI20h4S1FRK99e435I1Byx1X0r59XakELvofR3HXdh7ULQMc/kkNuImyWVIVw bcu10GuG9VAD2enjikSw325/CpdbDB6vvOwL5otR3ch/j2EtlZS8wJZvSAVi9yTTbosW DHxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VSRUstEi; 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 u9si20534162edd.596.2020.12.28.06.26.57; Mon, 28 Dec 2020 06:27:21 -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=VSRUstEi; 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 S2502814AbgL1OXe (ORCPT + 99 others); Mon, 28 Dec 2020 09:23:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:56064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437893AbgL1OVA (ORCPT ); Mon, 28 Dec 2020 09:21:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6281E22B2E; Mon, 28 Dec 2020 14:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165245; bh=5zn/4xyB1eu5gYq4y6UvWcr7Apf3HUkruUXsWMQBIZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VSRUstEipRUM6ql2dMRS4XkScUJEjardLrBqG6j31oPXRSJrSMWS7gKccVrOHS83/ NZFy+mVLO+UTg7BJu5qyTcuWORpsLTPhosfc1V/QAziMRP8/+dAMiyWNyXHr09gyZs +aVBdUXLKAsL4y1PJD9rSWE1ldpTMz4MJKkUobek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 463/717] i40e, xsk: clear the status bits for the next_to_use descriptor Date: Mon, 28 Dec 2020 13:47:41 +0100 Message-Id: <20201228125043.154251286@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Björn Töpel [ Upstream commit 64050b5b8706d304ba647591b06e1eddc55e8bd9 ] On the Rx side, the next_to_use index points to the next item in the HW ring to be refilled/allocated, and next_to_clean points to the next item to potentially be processed. When the HW Rx ring is fully refilled, i.e. no packets has been processed, the next_to_use will be next_to_clean - 1. When the ring is fully processed next_to_clean will be equal to next_to_use. The latter case is where a bug is triggered. If the next_to_use bits are not cleared, and the "fully processed" state is entered, a stale descriptor can be processed. The skb-path correctly clear the status bit for the next_to_use descriptor, but the AF_XDP zero-copy path did not do that. This change adds the status bits clearing of the next_to_use descriptor. Fixes: 3b4f0b66c2b3 ("i40e, xsk: Migrate to new MEM_TYPE_XSK_BUFF_POOL") Signed-off-by: Björn Töpel Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index 567fd67e900ef..e402c62eb3137 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -219,8 +219,11 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count) } while (count); no_buffers: - if (rx_ring->next_to_use != ntu) + if (rx_ring->next_to_use != ntu) { + /* clear the status bits for the next_to_use descriptor */ + rx_desc->wb.qword1.status_error_len = 0; i40e_release_rx_desc(rx_ring, ntu); + } return ok; } -- 2.27.0