Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3668999pxb; Mon, 24 Jan 2022 14:56:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwJgX4VqSSC3BIDU+K12HEvKPhD7eQq3xyUCKM72CE1JsOsu/FSf616GJKbJjSjA5JI/Qt X-Received: by 2002:a63:a84b:: with SMTP id i11mr13168216pgp.486.1643065011555; Mon, 24 Jan 2022 14:56:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065011; cv=none; d=google.com; s=arc-20160816; b=ZYj33AztwUtDP8CFLSEJGUOlfUNGTeXxksKPdhz4HMTzTiW9GtrbVD4AW3NRXYsiaz sDYXtKF7iVLV++Au1wOEm6KQmN59NAyhNsvzOaB0HtstQAVm1K+279U63ITCminSXbHI SjAiY4xElPGE/+3Kc6EWE/N2aZCKqvUktpyeVPoWkMNol98LESYW57b93eoIUxlDKT/z Oqd6RqJEqY9U2IaZbTgfhrSj4YNvgFOt1adYfMpo7lyO0vGjOSj/727RejqgGRrQHIty Rd+Pk0EtQWRghsL/tkvpKxNBo/LjjonBR9yOxvx04hfCNl/tvaeXnj9kg4ohMtyZ8NBJ lb0w== 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=e4DVtu0OJo1iaRfh8Jo+T8lXQgknhHo4X9VkuuW/DZY=; b=I0KB1jCLkl5MzYfgRLI9cqQoALznCXSRH5Qhwqnw4Z54Vwrp4F9u1ljqW54kSwBg14 qDRum0OtNcQfnp8MqGZ31c7hr9VztEGpB9qQTl27h3wfcsg3ULc9Ez6MpQguVZYm58gK +pdbkb/lOC2dQXnbo5EftQ3bp8o4nBp2IqPrzmUE2IwWJOik8b8nch2YL1QUukZvhZqV HBhZfvs4ZS8/s98YSNzwXARfNpiyu9FuKsRBn81qN3JBr05eksD0z1ztAtgxa9cE649b /rhEAj2DOkbvkEx2HESjrxQyd0A/AxTRrgKniSOOo6hs6hfxFIpSMQSIL8FvSIho/Jyb FDag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qjcw02vL; 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 j7si13367164pfc.191.2022.01.24.14.56.39; Mon, 24 Jan 2022 14:56:51 -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=Qjcw02vL; 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 S1839764AbiAXWvy (ORCPT + 99 others); Mon, 24 Jan 2022 17:51:54 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33356 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378927AbiAXVoF (ORCPT ); Mon, 24 Jan 2022 16:44:05 -0500 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 D176B61574; Mon, 24 Jan 2022 21:44:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97D3EC340E4; Mon, 24 Jan 2022 21:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060644; bh=EjBx6VLc9soLrs83ucHSAMI+i/H49AZLt1t7DcmUv5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qjcw02vLYpzpJFse8CcxgCPB5+vAav3XWy7mAcQUHOaM+bRmNJg9Nq6PrAWtDR/vA EvWiQplnt3R32TBHn45bRTaX7qmp72c+3ggXurtLZ++t0WIgZE5WxDQYXRRWuzSfNb jk1gX9vV02inD7BztUfpjB5GDDCGldoMcreUPNn8= 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 0973/1039] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:46:02 +0100 Message-Id: <20220124184158.001190784@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 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 @@ -747,7 +747,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; @@ -757,7 +757,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);