Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3584096pxb; Mon, 24 Jan 2022 12:49:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy05D2YPN2gjdamlePjAHzJGWykswL6wDkmMekHf5/p9pFy1363+r5F4jHxdHXMXgAVmovG X-Received: by 2002:a17:90b:2281:: with SMTP id kx1mr73057pjb.37.1643057389080; Mon, 24 Jan 2022 12:49:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057389; cv=none; d=google.com; s=arc-20160816; b=lUK84iBvjc1YffIRVGMkRhL0UKyzBMBS0Sun7JZ9Sbsihm0kzqjBEPGM/XiYpuGNV1 Yjpa26+HiVGlO9rgCfItt7HTRDAi/xXC+i9GmZC17nVRkK9foZIc/Dn75bp4ZrR0otXd DSkWKqZeNRV+g5PlszWW8y/KX53C00kbvP7/vhSWEe4AOj6BiJ3/drdA/N67DD+/38vk HLNhzkJQIB63sf/9kCHIZ6EB8iyRBTuTdjJWbdolx7ho9HMF7ufwvoAYWixV7xf+dKs4 7W0pDgmxkUDXFpcYjhCuTfOGbpMFTO+Cx0BdnTmPffHtoOkZXg0zaE7+4u61GOJhEQ2j O84g== 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=fF4Q/yG3C2KKy5XnrcnOn1ya83pzidO6HQAMFPOKgGY=; b=tii/OV47Ih4Q7o91lACtZrmU+4R+RePPaMfdSClKJfg9H2lfqbgJ/bT01JfbjXR80K +1iKTmduaat5bhwXfa+kAXWKUXjInvOUmZSdEnRvWFMhL6nYLjHxEcZZG/rQe8h9qE41 3TQRhbtPMWcYkYD+TOwdNNavHmbyJHg4kRWamSGxlBLE2UDuN+ZSYhbEKpbk4YsWymh5 MDTvHmGz8UD2OTIKp4tArzWreWLIyLsxxMvHkCsWufR2lxI+xUyqMFHtnQn8zNOQoWX9 ZkQOOFOrtS2+4lTiD0TXAHPUr3W1pkmRSAyCgpRTN1B2E8liZa9A/6z+ggv5feKKmMQB HWug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SE8YkIDa; 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 l70si8014392pgd.707.2022.01.24.12.49.36; Mon, 24 Jan 2022 12:49:49 -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=SE8YkIDa; 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 S1377466AbiAXUFb (ORCPT + 99 others); Mon, 24 Jan 2022 15:05:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349990AbiAXTry (ORCPT ); Mon, 24 Jan 2022 14:47:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B350C038AF4; Mon, 24 Jan 2022 11:23:28 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BEF1961496; Mon, 24 Jan 2022 19:23:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73D23C36AE2; Mon, 24 Jan 2022 19:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052207; bh=WIhonFUuLPDgILEzIj8zMYalQ6tBoRgyQ7YNS/mS6RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SE8YkIDaapaFZ9eUce/9+9jnmS0VU3QKn01siD7rAMVySd5tnI0Us0LCVX2WmBGkO Un2z+2AHk8fB54rAsAp8MZsu7249JJOhKAupvSLbrdInb2Sk/uUVXwNkjHOltZwIC2 658d8DArUz10ruBOO1uVSPT8cWmQntxR19Uy5aqY= 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 4.19 224/239] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:44:22 +0100 Message-Id: <20220124183950.232834013@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 aba57a823d2985a2cc8c74a2535f3a88e68d9424 upstream. The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use. 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 @@ -682,7 +682,7 @@ axienet_start_xmit(struct sk_buff *skb, num_frag = skb_shinfo(skb)->nr_frags; cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; - if (axienet_check_tx_bd_space(lp, num_frag)) { + if (axienet_check_tx_bd_space(lp, num_frag + 1)) { if (netif_queue_stopped(ndev)) return NETDEV_TX_BUSY; @@ -692,7 +692,7 @@ axienet_start_xmit(struct sk_buff *skb, smp_mb(); /* Space might have just been freed - check again */ - if (axienet_check_tx_bd_space(lp, num_frag)) + if (axienet_check_tx_bd_space(lp, num_frag + 1)) return NETDEV_TX_BUSY; netif_wake_queue(ndev);