Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3943075pxj; Mon, 21 Jun 2021 09:53:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza8Ob+CTvYBrgACqqxB6TSQrmjcLLxFfMe0Pkxp3YPJYxxN9s82oDLouRYA0rznEcTqXgi X-Received: by 2002:a02:866b:: with SMTP id e98mr18963969jai.48.1624294404080; Mon, 21 Jun 2021 09:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624294404; cv=none; d=google.com; s=arc-20160816; b=fjsRUElh5cQEO7CFJlWU86qT91LTb6ntTHf1AGjHVyJ7dXtSWxjWUsZXyyIyL7p7KQ aOHdt2uEyWSn+RVWvkgSvNM3fKc97VGhycAqqSFkUchXppjH/ojk8VquR1+rQIGxvpk4 vnubk6YALgNmxnbuQfinioPZqKKa3l0NrEOl5G7R8U6GADE7WBBYc44LL5jz4/0SzLdU jDnWMAXJZDSC84vSAGqdgXYVqpGMuqWN258mQZGRywkt6v1g94Dd4wC+jJcJeU1bWfSA g2fue7NorimB62gsFtFw+3dGRd/VXGcT0DQTBiyTMVcw6Ur4S979Tdmkyb0SFLzbTfUk jArw== 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=lsEupM0ga3I7VatMu2J2o+kQfaTzn2JRjE3sHnZBSLY=; b=mt2ScfPxd83OtaYup8gxnGkLMeQ9aL639q6EJ7e+e8uPsx7dYnZ0vOL4KDjGnZGUu3 LA+8Ty7Thyg8c5pVwltjcGRKEBQrxq2pUJUnOd1h8qbvqyxuXVLdPui3qCq1rd8vomc+ ZqCuGRck+IKNTMaUSmEHnQCuEgTxss7dHx2Lju6czhtNz5OBvhXLNYVsvf5ovtnD1/26 5+H5yLc9O4hOlYmrF1YMIf/ys63u0sTnKaETMhXL+gTePuHN2MjlXVEZtXrVeNKiYiAt KJ09YKL7cCLQRqsPJfZ9c5sk4Ghz7JEO83D6neu0Q1RIEJiq6WDjP1nrzl424WVB805G IQmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0JjibmtQ; 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 w4si22065155iov.14.2021.06.21.09.53.12; Mon, 21 Jun 2021 09:53:24 -0700 (PDT) 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=0JjibmtQ; 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 S232854AbhFUQxj (ORCPT + 99 others); Mon, 21 Jun 2021 12:53:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:38112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233278AbhFUQt3 (ORCPT ); Mon, 21 Jun 2021 12:49:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7695661363; Mon, 21 Jun 2021 16:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293276; bh=e/euqjV2yE9+gV+RI8fynVejNkPLYrzrh/Y66KQjMqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0JjibmtQmgatm9yOkOuGnB/zkjn1lVLhUFGD+YTi/nfQtBWZXeQUERvID59AkCb5I cigic+pU/rC+164kjtkPi8LMz3tgjsHSqPyg410gSy6N8gLdDuLImARmpUdagU7HzV AEQkAnKjo2tFXN/IiG3lVvJo1jM3oiSjrJY6ifns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Esben Haabendal , "David S. Miller" Subject: [PATCH 5.12 163/178] net: ll_temac: Fix TX BD buffer overwrite Date: Mon, 21 Jun 2021 18:16:17 +0200 Message-Id: <20210621154928.300583932@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@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: Esben Haabendal commit c364df2489b8ef2f5e3159b1dff1ff1fdb16040d upstream. Just as the initial check, we need to ensure num_frag+1 buffers available, as that is the number of buffers we are going to use. This fixes a buffer overflow, which might be seen during heavy network load. Complete lockup of TEMAC was reproducible within about 10 minutes of a particular load. Fixes: 84823ff80f74 ("net: ll_temac: Fix race condition causing TX hang") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Esben Haabendal Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -849,7 +849,7 @@ temac_start_xmit(struct sk_buff *skb, st smp_mb(); /* Space might have just been freed - check again */ - if (temac_check_tx_bd_space(lp, num_frag)) + if (temac_check_tx_bd_space(lp, num_frag + 1)) return NETDEV_TX_BUSY; netif_wake_queue(ndev);