netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Tariq Toukan <tariqt@nvidia.com>
Cc: Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, Gal Pressman <gal@nvidia.com>,
	Moshe Shemesh <moshe@nvidia.com>,
	Cosmin Ratiu <cratiu@nvidia.com>
Subject: Re: [PATCH net 2/2] net/mlx5e: Avoid unregistering PSP twice
Date: Tue, 2 Dec 2025 15:24:21 +0000	[thread overview]
Message-ID: <aS8EpZ3UYkfwpCyH@horms.kernel.org> (raw)
In-Reply-To: <1764602008-1334866-3-git-send-email-tariqt@nvidia.com>

On Mon, Dec 01, 2025 at 05:13:28PM +0200, Tariq Toukan wrote:
> From: Cosmin Ratiu <cratiu@nvidia.com>
> 
> PSP is unregistered twice in:
> _mlx5e_remove -> mlx5e_psp_unregister
> mlx5e_nic_cleanup -> mlx5e_psp_unregister
> 
> This leads to a refcount underflow in some conditions:
> ------------[ cut here ]------------
> refcount_t: underflow; use-after-free.
> WARNING: CPU: 2 PID: 1694 at lib/refcount.c:28 refcount_warn_saturate+0xd8/0xe0
> [...]
>  mlx5e_psp_unregister+0x26/0x50 [mlx5_core]
>  mlx5e_nic_cleanup+0x26/0x90 [mlx5_core]
>  mlx5e_remove+0xe6/0x1f0 [mlx5_core]
>  auxiliary_bus_remove+0x18/0x30
>  device_release_driver_internal+0x194/0x1f0
>  bus_remove_device+0xc6/0x130
>  device_del+0x159/0x3c0
>  mlx5_rescan_drivers_locked+0xbc/0x2a0 [mlx5_core]
> [...]
> 
> Do not directly remove psp from the _mlx5e_remove path, the PSP cleanup
> happens as part of profile cleanup.
> 
> Fixes: 89ee2d92f66c ("net/mlx5e: Support PSP offload functionality")
> Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

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


  reply	other threads:[~2025-12-02 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 15:13 [PATCH net 0/2] mlx5 misc fixes 2025-12-01 Tariq Toukan
2025-12-01 15:13 ` [PATCH net 1/2] net/mlx5: make enable_mpesw idempotent Tariq Toukan
2025-12-02 15:23   ` Simon Horman
2025-12-01 15:13 ` [PATCH net 2/2] net/mlx5e: Avoid unregistering PSP twice Tariq Toukan
2025-12-02 15:24   ` Simon Horman [this message]
2025-12-04 11:00 ` [PATCH net 0/2] mlx5 misc fixes 2025-12-01 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=aS8EpZ3UYkfwpCyH@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@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).