Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3930464pxj; Mon, 21 Jun 2021 09:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfTzNVRL7IJDahQkzG+1MQfe4Qeu9sWPTmYX+ambKrA1nysfPcjrr0e83tOYx+H+l1Nw1L X-Received: by 2002:a17:906:7b83:: with SMTP id s3mr22468333ejo.190.1624293388166; Mon, 21 Jun 2021 09:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293388; cv=none; d=google.com; s=arc-20160816; b=S6c5nLQcGvxbdtcK/7NQgEBt7YWtyTMhJC/4wHhnvYDNcG7fnpIC8/z8EwK9MHP1Q3 iAuuLXjUA+CCKh4xCHSMICh9K3Fgzkcf135caWFV1ILfV9Qk+itbxGhUzcRO7yFU6QqJ Y+pmj45GzFM3tgIaLUUVRjSmLE+sQTNLKRIFZVooMjYYAa3dP5tQqKY3p/wAdoqS5Qts FGPGhEfxD5eh3phBj3mkgLhwtWTJwkNwaLK5aeXRFdD9L80xIA0AK8wSQPNtzTtW+IcL oZRK3Tc9/CPh6QbPyV7m0IT6+qD4lk0jOufezL4MFkRqAY7IUTnxLf9B5cQhakpD1fYD e8Kw== 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=MvPJ2SpOnxRWOfqhZzNe8fQDY/pXWszlAfLZqq4x16gmamqTj7udTpztSs96qXcQJP Edg92V+uF4EQb3uzc6Uy1/XVwM0+G54j8aZkULt0EQWiInUMTvBXLlbvsThC9Piirvcu d9euUUJCnPckATndI8P8NE3P0RWOMZrHXPD6d0kdDK/r5tpcKrEwcMj6+R3cq+tE+p3w 1fizyusUNTVC6A7tEHCH+MTvW/ffgUIQNB+KDhl6g2bvhHPLnwYsp+VQwGcfITJzAgA2 GAR6ctEHHbrKGSGE2VWoQ+OXJfDJjP3mct+BTodleJfpsVZRRWaKMRaE0ud0KQW4P7Xj /EUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x9qB3y+M; 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 hx3si10789360ejc.274.2021.06.21.09.36.05; Mon, 21 Jun 2021 09:36:28 -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=x9qB3y+M; 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 S232754AbhFUQhY (ORCPT + 99 others); Mon, 21 Jun 2021 12:37:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:56162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbhFUQdT (ORCPT ); Mon, 21 Jun 2021 12:33:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D95FD613D1; Mon, 21 Jun 2021 16:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292793; bh=e/euqjV2yE9+gV+RI8fynVejNkPLYrzrh/Y66KQjMqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9qB3y+Mv4VbH3lMfDYKYhlL6L+7YF5XiNyndJ25ZGQxA821z71sySD22t8uxeiSH rIubKDY/7SqKzP+eyGUgf9lsYGesCizd567LMdkN8bCaZFcDr+TN9YzanlGWinnOSv 91ccwcKhCzIv24gBAkOZ7TBqStFL3H4nvORbooFw= 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.10 133/146] net: ll_temac: Fix TX BD buffer overwrite Date: Mon, 21 Jun 2021 18:16:03 +0200 Message-Id: <20210621154920.019600162@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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);