Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3549772pxb; Mon, 24 Jan 2022 12:00:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwige7+HCEAdcKz3c1gzloSZWs+maUw8MXPM377vrNGRQYorn+DSWNpaFgFF0vOB4SqJKef X-Received: by 2002:a62:7686:0:b0:4c9:f270:1f39 with SMTP id r128-20020a627686000000b004c9f2701f39mr2956400pfc.50.1643054445751; Mon, 24 Jan 2022 12:00:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054445; cv=none; d=google.com; s=arc-20160816; b=WWUJlPmLN3j7gVA7d6Rztl8zhVM3Xlah+kq9dqxTRgiBigrHlZmpTOhZkoZsjBWeuI vXrZfwKHVLrINsFNp2v1KpFsuohdxuuxTzkjnEqPnMScigFKJ4X2nsoOvH9x904S4xqb vvSm0onwT2A5RUzf3Ysei1TTZjbim/6CfbYKygz7Sc7rbuqvjorZTMmR1/MSU5klZW5p KiFpmgginv8zhCEsrnij79ZDLSqOoI+bY43veOuBh0nxhnS3V6r/NCLwrPeuyMVU8ees P+6Hi9fGISQYNJFa1T60K+F5oZ51XS34JsXxzsDwNXHbJl7rY/Cy7M6fQhlVGR0yUQY1 VOsw== 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=IF+ZJvs76hJxKT/AM6Dq1S+lZDotkbdoHvT64bBkcBc=; b=BXRPzH+2Yvf+xLZ2oxO+voY6U947JpqxhQ4a/nJAMk6jbXhr1wBV+mMWD2/TG716FU mRxHSE+uEQJV3Dtuo8/O40A+HgW3rjCHtcr3zdKTt04L9/PmXh71LxPY25MH6UknB9Po iI2Gf6fmYW/+/TfvyIPaoQ7j36wppa6Yh7ZtEdOLPHhKtiQDj7jzGvqw1L7AL1C/ld+V bPKj8Nj90hw3/MAsSoRiisJhOhnPP/j9Vaq7ER+QhF4TTEW0p3GcrpuO0YSsFjOK0oIc pu2Z2nvDnNcW4EAN77/iHXC2zXCX0X4CvZ1kwNkV/0DGuuuR8rMOAjZT9bbBgr+EIc1K 4irA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zC4+w1Um; 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 q7si15391010pfj.263.2022.01.24.12.00.33; Mon, 24 Jan 2022 12:00:45 -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=zC4+w1Um; 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 S1344340AbiAXS6z (ORCPT + 99 others); Mon, 24 Jan 2022 13:58:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344424AbiAXSyj (ORCPT ); Mon, 24 Jan 2022 13:54:39 -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 5369FC061744; Mon, 24 Jan 2022 10:53:23 -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 E6644614D4; Mon, 24 Jan 2022 18:53:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6C64C340E5; Mon, 24 Jan 2022 18:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050402; bh=zvNxJIBpGYAJAFDVKjkPscRL8chuDPUd05tL6Yf77iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zC4+w1UmkXksjyvnXnn4xgET5iiB7agvo774wmlKVqkYXYAZHsS73o/YWTAk0llgM +I3IQ/1CiYjuMmYLt3NEUtDoEjt1AG+alPCD27B88sjWM3WQfXkvPW+Egq0SXOu2Gt hq3OzhksnZmGKdYggVL0L/ErF3RJl+CtjOT+fdCw= 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.4 106/114] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:43:21 +0100 Message-Id: <20220124183930.380100924@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@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 @@ -681,7 +681,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; @@ -691,7 +691,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);