Re: [PATCH net] net/mlx5: Fix double unregister of HCA_PORTS component

Gerd Bayer
2025-12-04T09:48:34Z

On Wed, 2025-12-03 at 17:14 +0200, Moshe Shemesh wrote:
>
> On 12/2/2025 1:12 PM, Gerd Bayer wrote:
> >

[ ... snip ... ]

> >
> > Fixes: 5a977b5833b7 ("net/mlx5: Lag, move devcom registration to LAG layer")
> > Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
>
> Reviewed-by: Moshe Shemesh <moshe@nvidia.com>> ---
> > Hi Shay et al,
> >
>
> Hi Gerd,
> I stepped on this bug recently too, without s390 and was about to
> submit same fix :) So as you wrote it is unrelated to Lukas' patches and
> this fix is correct.

Good to hear. I wonder if you could share how you got to run into this?

>
> >
> > I've spotted two additional places where the devcom reference is not
> > cleared after calling mlx5_devcom_unregister_component() in
> > drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c that I have not
> > addressed with a patch, since I'm unclear about how to test these
> > paths.
>
> As for the other cases, we had the patch 664f76be38a1 ("net/mlx5: Fix
> IPsec cleanup over MPV device") and two other cases on shared clock and
> SD but I don't see any flow the shared clock or SD can fail,
> specifically mlx5_sd_cleanup() checks sd pointer at beginning of the
> function and nullify it right after sd_unregister() that free devcom.

I didn't locate any calls to mxl5_devcom_unregister_component() in
"shared clock" - is that not yet upstream?

Regarding SD, I follow that sd_cleanup() is followed immediately after
sd_unregister() and does the clean-up. One path remains uncovered
though: The error exit at
https://elixir.bootlin.com/linux/v6.18/source/drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c#L265

Not sure, how likely that is...

Thanks,
Gerd