Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3618110pxb; Mon, 24 Jan 2022 13:38:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYbX7TRrq9yzo5SXS+aLcB9wwIHZWZ3XTCbrHxBQF19ktEMLUhWN5txSWDx6MwyQ+w20UI X-Received: by 2002:a17:902:e84d:b0:14b:5631:445 with SMTP id t13-20020a170902e84d00b0014b56310445mr5253078plg.21.1643060288904; Mon, 24 Jan 2022 13:38:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060288; cv=none; d=google.com; s=arc-20160816; b=qdjf11TRa8z/XaUJMeJtt/6CEhbUZvvhzDbK8R8992WUAO4bGUko5iX7Pd11UjXETa 7JUEjV7qpC+cs3snlI1e5Xf2m0QRlMXp6JM3ZmE8mmYjnbDRDaogLCwNdK0j+jAARapx AgUpoPsqB0mknhyJIIJ/xCNhP7d32FZShqu5jX5ihmZvZMNI4daZb4n9nrGZBkdD9lPg 8YfWbuWoU+AVTH7OTCFpjnuEohWQ8rr1J/cToSdcMhkCuv6G0k7x0EAvJq8Dd9ayZJe/ wO9I4XROaIwWKs45uWD2wF53gwVz//KiQNDjT7m5Y2q7ENo9xCnDJw/+qmQbzNsrdiKa TW0Q== 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=qLAoGNM4/GtarYaEZgIfYfpKI7cs7YzXynV1bttkZfjzs+8wrB4LrfJexcj0U4dLdH +9NFY/+Np0JF15Ojl7z3yBJouQnJrTUN7z/scYBbJZWdt8FjMSEcwWInWMJAZHEg6Hra 3oH8I5IVZjfuGi9ByNsqWigZNYsAgtzrVaBHTfxKhq7dJjG4cPalH8WnW+yQywyrZg6x R/fl23/WnYOdfqd77D8jAwjS6KEs0hPastZBAMRf+wNSZCzIHjhGsKQqw+TdecnlZNL7 3Tc3tr1TVZ7KNO1J4YDvmSWVrb1rlcyNMY6gLGD+uQM5wm83UxQWdGGIDRTMR9H6DcKo 4aFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a3joNH5q; 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 p19si14008547plq.290.2022.01.24.13.37.56; Mon, 24 Jan 2022 13:38:08 -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=a3joNH5q; 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 S1449722AbiAXVQE (ORCPT + 99 others); Mon, 24 Jan 2022 16:16:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43554 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389657AbiAXUtt (ORCPT ); Mon, 24 Jan 2022 15:49:49 -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 5777C60C11; Mon, 24 Jan 2022 20:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 305DCC340E5; Mon, 24 Jan 2022 20:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057388; bh=EjBx6VLc9soLrs83ucHSAMI+i/H49AZLt1t7DcmUv5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3joNH5qfKCFxgDqQUKXDOWnkfyfYUDcU/oNBuGUxfs7i70ZRcpqjEESEc+WDokSm lXtx40UnMoTKitH6/Qy4RNr8I17DLN67i2P1NLW/hVaP6XlXgaV+2DRLLnHnIOndzH OD/nQu2CTUdR1kaf+SJmf6piA5zLQcZNNUmB1zlE= 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.15 797/846] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:45:14 +0100 Message-Id: <20220124184128.446665823@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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);