Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558551pxb; Mon, 24 Jan 2022 12:11:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOPQ83sHVAK4iUG/lT/RBXlZErTyzQZL2TS7gfXZtl72KKJ+v0NIINXHrRkCBCxFwrpLfF X-Received: by 2002:a63:b545:: with SMTP id u5mr12945719pgo.420.1643055096150; Mon, 24 Jan 2022 12:11:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055096; cv=none; d=google.com; s=arc-20160816; b=hDO1T8Tdvj/4WEwnn9Nt1lXq8v2JK3M0ymNGamfpLq1oHlD0qHtIm1oosJI9poz69I lHZjr1KJrvOyF3fjEvcMQ/DLAhJmDMEsRmT55rQly+4fTdE8RtVznM9W3mmrzYKmk41b ATDGNPzI2iuk+P51WHu/BeaH+OakjP0frbN206t5kpwAx85rX+uSghckzhNMuPk9rflv tiYqJroXKbCdvhd2tUg4bypb3WC85UENrh1fBN4g4QAG34cSM7n2rSJkNFV+w+6Qn400 bTcqbSQEaZB6BhVIzVYpdPUBeh/JzKgf5zhROGx37ARjLDUajSLz1zLjyLlv5ho4lf7M 73Cg== 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=secU+/fiYhyFLOg98R0HI/owoW1aSp0SHQ2agzQywYo=; b=lOzMYUIAQHWRIn+X0Q4oyR8suZ0nYbf2ys20Zx0GXcOnd5THC6I1EWuqRGR9EitMi1 plEee6HGfV9oVE7LhV7DCbMxXf7jhZYb3ncTfAdsVS5QVgQnkjrmPTBN6kI6xQuYEY6w ZZJFCygciG3hukieFckZ60h1/i8kqU5bVAth0UhDqL9+kQ37m8vgq1Pd+LTI6FTcGrYO J9ki1B1D7Sys1UkMHDhfz/kh+KVZ5cM0cAmYrMZ/DMvt/+YU6jJIcaY8pI3M/e38NL0c pQ46ZzX649o5uXEWuqrt4tZsR1BWSRCLoFH3FAPUCaOkxeVKsLwtiGxY2xcDeiYvVwo6 gKkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EcnbjoBd; 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 z3si12990224plo.583.2022.01.24.12.11.21; Mon, 24 Jan 2022 12:11:36 -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=EcnbjoBd; 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 S1346406AbiAXTOR (ORCPT + 99 others); Mon, 24 Jan 2022 14:14:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346272AbiAXTFP (ORCPT ); Mon, 24 Jan 2022 14:05:15 -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 90EA2C0613F0; Mon, 24 Jan 2022 11:01: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 59D0AB8123A; Mon, 24 Jan 2022 19:01:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A1FEC340EA; Mon, 24 Jan 2022 19:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050861; bh=MAeeJZOxqn6EdjZ+yLTH/ZYr2Om5f/r9frQ/yzaDLFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcnbjoBdne6VWiGRW+dtQPPyMv20XLvMPB50APa4SBwSrgJaQfZY3vgmWvm5lc7YS 3LvdWeovlWvaotVnCFXcTrcOnTR8pe3qAvqWRt1gY3k8eRHCWPcZsjWsZnqkAkO4gO NUM8IlG0enuhAH0XQXHt1dop3AKkII7arnyZRvPI= 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.9 135/157] net: axienet: fix number of TX ring slots for available check Date: Mon, 24 Jan 2022 19:43:45 +0100 Message-Id: <20220124183937.059128872@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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 @@ -680,7 +680,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; @@ -690,7 +690,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);