From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5199E342CB3; Wed, 20 May 2026 18:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301878; cv=none; b=lFazp9Zw6oqcKRhQp/PrtW/jyVU2fS/qpUeDD50P8V0TxxJofvvPK1E3xJ5YcRkn64Sc9olAsKyVQVDvX2UJgAXNjCa3PxKQ6qoWQ55L9Nq76mB2Kofb/v97xvuN9x6oyWymMZbTol4lN09n0OQJ755CiDdfwQpJmlxwi3DSZ14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301878; c=relaxed/simple; bh=m5FRtuetow/wCLHFDv8wUD4ZN4wfvwch7DcC/1zT2T0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qR6awN/ArJUBlHrGC8ZxCeH8KfZ7j2WDCTXY8QleRaaLxnJYqLkv2CmR+qI1OD/YsRh1brnn9x68smULmxVVyuRcR3lQujesdJ91XReGmQO7QCadDHQPGv5djIcRt3zNm6smFj75Gli3KjEMzu9HlEbem+gjwEdAtI2IvRUFtP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iLqXznhs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iLqXznhs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 832DD1F000E9; Wed, 20 May 2026 18:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779301877; bh=OzTUq+hfgWrbIo42ABNdidQLyl1SJWUUepcfU+FOzeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iLqXznhsjiHJst3v3mZadf8fTfHxzrHk+XqQ3ppguUdUGbXwjT7/xF5XnJmAqUgAH DQYKARvnVcZMlx2u6auFbu2ySft+RSzgzzDZLP3+aDXh72qq6l+afn/uD5SRl09YaT 7Vn+EgbQD6rfBO99nAE7WWcdFHeHU6iRzd9t2NBY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Justin Chen , Nicolai Buchwitz , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 054/508] net: bcmgenet: fix off-by-one in bcmgenet_put_txcb Date: Wed, 20 May 2026 18:17:57 +0200 Message-ID: <20260520162059.769594202@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Justin Chen [ Upstream commit 57f3f53d2c9c5a9e133596e2f7bc1c50688a6d38 ] The write_ptr points to the next open tx_cb. We want to return the tx_cb that gets rewinded, so we must rewind the pointer first then return the tx_cb that it points to. That way the txcb can be correctly cleaned up. Fixes: 876dbadd53a7 ("net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()") Signed-off-by: Justin Chen Reviewed-by: Nicolai Buchwitz Link: https://patch.msgid.link/20260406175756.134567-2-justin.chen@broadcom.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 79d096a371ae7..cdbe47c7ba280 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -1749,15 +1749,15 @@ static struct enet_cb *bcmgenet_put_txcb(struct bcmgenet_priv *priv, { struct enet_cb *tx_cb_ptr; - tx_cb_ptr = ring->cbs; - tx_cb_ptr += ring->write_ptr - ring->cb_ptr; - /* Rewinding local write pointer */ if (ring->write_ptr == ring->cb_ptr) ring->write_ptr = ring->end_ptr; else ring->write_ptr--; + tx_cb_ptr = ring->cbs; + tx_cb_ptr += ring->write_ptr - ring->cb_ptr; + return tx_cb_ptr; } -- 2.53.0