Hello Dariusz,

Thanks for the review.

On Fri, 11 Sept 2026 at 11:00, Dariusz Sosnowski <[email protected]> wrote:
> > @@ -1963,17 +1989,15 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
> >                       mlx5_flex_item_port_cleanup(eth_dev);
> >               mlx5_free(priv->ext_rxqs);
> >               mlx5_free(priv->ext_txqs);
> > +             mlx5_free(priv->mac);
> > +             eth_dev->data->mac_addrs = NULL;
>
> This can segfault because eth_dev is allocated later than priv.
> Previous version of the error rollback accounted for that
> (where mac_addrs was reset only if eth_dev != NULL).
> The same logic applies in Windows code.
>
> Could you please revert that?

Well, the code before looked fishy to me.
Resetting mac_addrs if (eth_dev != NULL) outside of the if (priv !=
NULL) block seems incorrect.


> > +             mlx5_free(priv->mac_own);
> >               mlx5_free(priv);
> >               if (eth_dev != NULL)
> >                       eth_dev->data->dev_private = NULL;

I would rather reset mac_addrs to NULL along the dev_private reset in
the if (eth_dev != NULL) block right after.
The comment about mac_addrs (see below) being in dev_private can also
be removed.

WDYT?


> >       }
> > -     if (eth_dev != NULL) {
> > -             /* mac_addrs must not be freed alone because part of
> > -              * dev_private
> > -              **/
> > -             eth_dev->data->mac_addrs = NULL;
> > +     if (eth_dev != NULL)
> >               rte_eth_dev_release_port(eth_dev);
> > -     }
> >       if (sh)
> >               mlx5_free_shared_dev_ctx(sh);
> >       if (nl_rdma >= 0)


-- 
David Marchand

Reply via email to