netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Petr Machata <petrm@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
	mlxsw@nvidia.com
Subject: Re: [PATCH net 1/3] mlxsw: spectrum_router: Fix possible neighbour reference count leak
Date: Wed, 3 Dec 2025 17:54:02 +0000	[thread overview]
Message-ID: <aTB5Oqp5ilW5fOpv@horms.kernel.org> (raw)
In-Reply-To: <ec2934ae4aca187a8d8c9329a08ce93cca411378.1764695650.git.petrm@nvidia.com>

On Tue, Dec 02, 2025 at 06:44:11PM +0100, Petr Machata wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> mlxsw_sp_router_schedule_work() takes a reference on a neighbour,
> expecting a work item to release it later on. However, we might fail to
> schedule the work item, in which case the neighbour reference count will
> be leaked.
> 
> Fix by taking the reference just before scheduling the work item. Note
> that mlxsw_sp_router_schedule_work() can receive a NULL neighbour
> pointer, but neigh_clone() handles that correctly.
> 
> Spotted during code review, did not actually observe the reference count
> leak.
> 
> Fixes: 151b89f6025a ("mlxsw: spectrum_router: Reuse work neighbor initialization in work scheduler")
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>


  reply	other threads:[~2025-12-03 17:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 17:44 [PATCH net 0/3] mlxsw: Three (m)router fixes Petr Machata
2025-12-02 17:44 ` [PATCH net 1/3] mlxsw: spectrum_router: Fix possible neighbour reference count leak Petr Machata
2025-12-03 17:54   ` Simon Horman [this message]
2025-12-02 17:44 ` [PATCH net 2/3] mlxsw: spectrum_router: Fix neighbour use-after-free Petr Machata
2025-12-03 17:55   ` Simon Horman
2025-12-02 17:44 ` [PATCH net 3/3] mlxsw: spectrum_mr: Fix use-after-free when updating multicast route stats Petr Machata
2025-12-03 17:55   ` Simon Horman
2025-12-05  3:20 ` [PATCH net 0/3] mlxsw: Three (m)router fixes 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=aTB5Oqp5ilW5fOpv@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    /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;
as well as URLs for NNTP newsgroup(s).