Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3570876pxb; Mon, 24 Jan 2022 12:29:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA/tgaRwkBqJe5LyjFv5HDlGuop7ZKKZalkMGsjkESC9ZzaVX5jqRcTml35spnzuRSZFHA X-Received: by 2002:a17:90a:1919:: with SMTP id 25mr40529pjg.181.1643056173862; Mon, 24 Jan 2022 12:29:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056173; cv=none; d=google.com; s=arc-20160816; b=RAKK5Y/SvlrefSMrXBaTDkieWbhRHp9Zrmhsq1k6Dn6KDTXHljfX7QUV4HVDerBSOW dVoFX5em35D6AtQsk+N0luOfr2sqwxNY6UBEq5jXRhNDbu+HNaGtKAesK/oN0+T+TCok XPoaXmDyTbn1jDtzEHKODB3hI/8scy5BLoSUCGSfOTsbnrvdHEV6HRrWafvvQns3pxjv 7GEBX8+jjJ9mCJqFO3KiNv9YJt18SaSWM82at3RJDPe1Z2OXV1ZwltA6auMtUVizhG1e VCCb5wSNlpQcJIh6WaUBaWE7d0U3b1zUOC7MwkBwcTwqpHSFrSrqLvfvb3GknTCdxShb nSBw== 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=SOlirLj+Ikz99IYaOsyulrV9jttIKcUvItsg1M0dg2pt1prGV0FY8L248aiFhpFaOd 0x/56PefbOGJA3ZFFdFX6JKi5vniE2I4EJqcrDaanrfP0YK2gqhhh1gu9K+8MlS82/XU +tCIm+5bsFSGpITJNUPaJN96rULSOHlG/OV/POCT02iTH74qaXkuETWJi/AatRPIXFhn dA6a1bUxokvk923Ku+/x5p47i4oG0HCut+/2ahGCv23QKpPVx7RjrHzk6+EVgQZ9UQeb PEl6GPOqDtFdpalpIJi8bW68/kc0y6TmuEJAf7fK6UWZ8No6LevYSzssmipZa9USw0bo iO/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jyLgYGm2; 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 pg16si354018pjb.74.2022.01.24.12.29.21; Mon, 24 Jan 2022 12:29:33 -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=jyLgYGm2; 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 S1352972AbiAXTbU (ORCPT + 99 others); Mon, 24 Jan 2022 14:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348058AbiAXTXZ (ORCPT ); Mon, 24 Jan 2022 14:23:25 -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 658B1C06125A; Mon, 24 Jan 2022 11:11:03 -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 23B61B81235; Mon, 24 Jan 2022 19:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37EAFC340E7; Mon, 24 Jan 2022 19:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051460; bh=WIhonFUuLPDgILEzIj8zMYalQ6tBoRgyQ7YNS/mS6RA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jyLgYGm2WIV9aQhbilpkoWfgwj4jPkNQ5i/9MRNYJL99448ajVWso02HEV7ODO9Yh gpsCKYeIDeyDAdjqzvfrQxbaBdUh/r6lFM+LPE2wdg+b9nxs+h5wiWAZJymVBjMEIx K8Pa8FxBCpIGwkbV4Wim9rn5q7VVexH3IQy8V2go= 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.14 169/186] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:44:04 +0100 Message-Id: <20220124183942.553407222@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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);