Re: [PATCH net V2 1/2] net/mlx5e: psp: Fix invalid access on PSP dev registration fail
From: Jakub Kicinski
Date: Mon Apr 27 2026 - 20:05:45 EST
On Sun, 26 Apr 2026 09:17:08 -0400 Willem de Bruijn wrote:
> > priv->psp->psp is initialized with the PSP device as returned by
> > psp_dev_create(). This could also return an error, in which case a
> > future psp_dev_unregister() will result in unpleasantness.
> >
> > Avoid that by using a local variable and only saving the PSP device when
> > registration succeeds.
> > Also apply some light refactoring of the functions managing the PSP
> > device in order to make them more readable/safe.
>
> This is generally discouraged as it obfuscates the fix.
+1, I should have said this during the v1 convo, I thought it's obvious
:\