Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3970924pxb; Tue, 25 Jan 2022 00:17:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyA/bsHSAuKtWwT3+nxBplzsOE4wKugMI4qeeXfIaIbNucgP3mYBkLiOF2RGIJVgFoPwxd X-Received: by 2002:a17:906:3819:: with SMTP id v25mr15009784ejc.539.1643098678325; Tue, 25 Jan 2022 00:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098678; cv=none; d=google.com; s=arc-20160816; b=AL+gBDkPGwQlqgqKLYVqnJ2AqWIa0bQO3C+2p7PhSB7P0YzNefJpJbXSM7XvnEKgTV 3Ce8Py9A3ErupimYaeZRf5YLd4WqtRAvZAZsB+PT8yD4HeJUTGwzsaEHCT9lRqlqBe8X kGvANnEFsb3zyusGMrlKjIXbkWKELAHxt9mxJmL+928b3x8tC5VS/tt/z7XoNidGQ2EK XdKY7WtUVP/2wCr42nxcaMgjQGNNp41RxdIuXDGX+XFmqx20tMI6Umz5HXZMTnUGBufe 43tC8alqRsQPh/22eJgU5ff6tclw3L5//kcNIWr/0PWu2E9apTo4w0r6biq1uq0d4+63 cshQ== 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=bHMPAePjDeIaiTQLdBlTBMT2dhK5ES64bjomtVmWrLY=; b=wDWRY8MmXNHJcHPj/6RO+aFM/4mlDKoy0B/2AEGYtP296DyLiXLGhTnalgFC+4Xe6k eqguI9AQ5QAiyP9vs3zt+ZnggsDj153fN9P5w+JdmVcmxtEAD0pU8dykgq4xOhRclSfV vMB+42JU0RPS3N5KGmKwm53Bc23p6rzEYfr2kqTvci6dKqncMc5flf88X7TbkhXWTwnP NgiEvJn1I4E4WphWElGWR1KKj9bVvdD221aVbeK6wunQlnW3nQ1ysJ3BCglkBOH1Q9xC Bvo14kyFQuE/LR8owQzSA+8SJwro7IOloOZR0uEdGaobItFUYo0OVYr5Ui2u87c86hmR kSvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZBvJgj0D; 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 v6si4282113ejk.470.2022.01.25.00.17.04; Tue, 25 Jan 2022 00:17:58 -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=ZBvJgj0D; 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 S3412092AbiAYAfn (ORCPT + 99 others); Mon, 24 Jan 2022 19:35:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364068AbiAXXqo (ORCPT ); Mon, 24 Jan 2022 18:46:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D10C0613AB; Mon, 24 Jan 2022 13:41:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1F7FB811A2; Mon, 24 Jan 2022 21:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25606C340E4; Mon, 24 Jan 2022 21:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060514; bh=z/kUukaJylcFxGt8AABs3R9KeYEcCOvB/8aKXDK3HDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBvJgj0Dmi3qHFTcbfbUFioC5B18frerxn/ta61Yxtwxw8Xm/OpwOxSh2AkcAc7SG v8KWKOPC35e/6eoibY9C2gDx/X2VzNjeaAEadnk7MZCy4KkGjV7zvZuhD5MfifwvKT aF+a+W3aFqynKljaZosbQLOnVIEtIbxQU+GNzHtk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.16 0972/1039] net: axienet: Fix TX ring slot available check Date: Mon, 24 Jan 2022 19:46:01 +0100 Message-Id: <20220124184157.963023294@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Robert Hancock commit 996defd7f8b5dafc1d480b7585c7c62437f80c3c upstream. The check for whether a TX ring slot was available was incorrect, since a slot which had been loaded with transmit data but the device had not started transmitting would be treated as available, potentially causing non-transmitted slots to be overwritten. The control field in the descriptor should be checked, rather than the status field (which may only be updated when the device completes the entry). Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -643,7 +643,6 @@ static int axienet_free_tx_chain(struct if (cur_p->skb && (status & XAXIDMA_BD_STS_COMPLETE_MASK)) dev_consume_skb_irq(cur_p->skb); - cur_p->cntrl = 0; cur_p->app0 = 0; cur_p->app1 = 0; cur_p->app2 = 0; @@ -651,6 +650,7 @@ static int axienet_free_tx_chain(struct cur_p->skb = NULL; /* ensure our transmit path and device don't prematurely see status cleared */ wmb(); + cur_p->cntrl = 0; cur_p->status = 0; if (sizep) @@ -713,7 +713,7 @@ static inline int axienet_check_tx_bd_sp /* Ensure we see all descriptor updates from device or TX IRQ path */ rmb(); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; - if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK) + if (cur_p->cntrl) return NETDEV_TX_BUSY; return 0; }