Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: petrm@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] mlxsw: fix refcount leak in mlxsw_sp_vrs_lpm_tree_replace()
Date: Thu, 11 Jun 2026 09:18:02 +0300	[thread overview]
Message-ID: <20260611061802.GB836457@shredder> (raw)
In-Reply-To: <20260609084730.215732-1-vulab@iscas.ac.cn>

Same comment as on the last patch regarding subject prefix

On Tue, Jun 09, 2026 at 08:47:30AM +0000, Wentao Liang wrote:
> When mlxsw_sp_vrs_lpm_tree_replace() fails after replacing some VRs,
> the error rollback loop does not correctly revert the preceding
> replacements. The loop decrements the index but fails to update the
> vr pointer, which still points to the VR that caused the failure. As
> a result, the condition and the rollback call always operate on the
> same VR, potentially calling mlxsw_sp_vr_lpm_tree_replace() multiple
> times on it while never rolling back the earlier VRs. Those VRs
> continue to hold a reference to new_tree acquired via
> mlxsw_sp_lpm_tree_hold(), leaking the reference count of new_tree.
> 
> Fix by reinitializing vr inside the error loop with the updated index:
> 
> 	vr = &mlxsw_sp->router->vrs[i];
> 
> so that the loop correctly iterates over all VRs that were actually
> replaced.
> 
> Cc: stable@vger.kernel.org
> Fixes: fc922bb0dd94 ("mlxsw: spectrum_router: Use one LPM tree for all virtual routers")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

  reply	other threads:[~2026-06-11  6:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  8:47 [PATCH] mlxsw: fix refcount leak in mlxsw_sp_vrs_lpm_tree_replace() Wentao Liang
2026-06-11  6:18 ` Ido Schimmel [this message]
2026-06-11 23:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260611061802.GB836457@shredder \
    --to=idosch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox