Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9089923pxu; Mon, 28 Dec 2020 06:23:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzWazaln0XAsgg2iuFVG3OCqUlkTHvyV5l5udp7xlLUwVAEKTGjJzs6EI4gZlCRG20SyGK X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr43157020edy.194.1609165400812; Mon, 28 Dec 2020 06:23:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165400; cv=none; d=google.com; s=arc-20160816; b=qqAcxLXMT1FvXv2C9qhEntcmli77CW71+Y1caySb2H+elDmAs7EQsq85y5b4Ue1all kof6+xEztkf7KeyGnzA2XgMaLe5F3AyqFmx7hFqOTwue+5LbJewYmstaurdLWagEUEHP QRESj/ongizChi7f0uKKivvKE5byMxsZAaPjEtGxQzducv/60jXp3pta7zoyS/YOX6NP K3UkGPmnCyvgUaXukkfvQ4U/rpi4IBwSQwO6F9DgZeZkpZ3w1rEg8f3p8+Ns4KJyd4D6 mhfTTdz9MxaTC9yfnI808PvXbsOUQsz9urgAvp0plZcDFGeh7UtPAAj5Fo1l4BEt3R7B qe7Q== 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=hUhbKryF3ZtY7ekDmWV5CQIUvKd9CKuSEVvkMuTd9go=; b=qUBMi7RAWLMsVtUWM62sIo/gDgIKg88P3fmae05QOntjozBOjbrov54axwcymrBoaO nEwVweFnBJimOzTqMSiUGzQQmm99DBeCdDg9VpIoGtT+JqaJdZsAyXjeZdVEnIaKqBLP MWKyHMQRAt3VfuPjAxk7CfGju7jO8mGpCKtFpoytM5y69ZVclM9Tje3Icr3L/0xMEZIG LiJHZHaEW0x67oGrgAuARXlwzP9FyrkkoxScW3rud3FUaJC4QFh/Kj2lcNen+kjaMtwF PoUeAkRIh5zWxqizDyaZOO3VnOnDn37zy2YiQzA8JikN584X2Fg6Ndpdp8gGd+vpZIEH u6rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="K/ERgqEM"; 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 33si20250902edr.343.2020.12.28.06.22.58; Mon, 28 Dec 2020 06:23:20 -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="K/ERgqEM"; 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 S2437939AbgL1OVd (ORCPT + 99 others); Mon, 28 Dec 2020 09:21:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502218AbgL1OVE (ORCPT ); Mon, 28 Dec 2020 09:21:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0BBCF206D4; Mon, 28 Dec 2020 14:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165242; bh=tz/dodCeW1DHdwoGekz2Ot5tcOa7R/FRsYGAIh+bSLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/ERgqEMHJwqKqZlbv5Quy+25QXjVf1AeSTZEWJ2STLNcxJyMpJP7cCNiJESmpXBu XQIPjn0kpfXYfI+SjflmYkIl8zUzcbzqmG+SUnVwIOw/p5UMzIOIUo9AwQ3VmOSs4l HbsHQCruuF1EGyNY6IQ4xJDfgMSyA28Bhx80f3vQ= 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 462/717] ice, xsk: clear the status bits for the next_to_use descriptor Date: Mon, 28 Dec 2020 13:47:40 +0100 Message-Id: <20201228125043.105740628@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 8d14768a7972b92c73259f0c9c45b969d85e3a60 ] 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: 2d4238f55697 ("ice: Add support for AF_XDP") Signed-off-by: Björn Töpel Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index 797886524054c..98101a8e2952d 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -446,8 +446,11 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) } } while (--count); - 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.status_error0 = 0; ice_release_rx_desc(rx_ring, ntu); + } return ret; } -- 2.27.0