Re: [Patch next] octeontx2-pf: fix potential double free in rvu_rep_create()

From: Markus Elfring
Date: Tue Apr 15 2025 - 03:32:53 EST



> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c

> > @@ -691,7 +690,6 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
> > NL_SET_ERR_MSG_MOD(extack,
> > "PFVF representor registration failed");
> > rvu_rep_devlink_port_unregister(rep);
> > - free_netdev(ndev);
> > goto exit;
> > }
>
> There is no potential double free here. If you notice the loop at the

> (De)allocations in loops are quite tricky.
>
> Nacked-by: Abdun Nihaal <abdun.nihaal@xxxxxxxxx>

Would you ever become interested to avoid a duplicate free_netdev(ndev) call
by using an additional label instead?

See also:
[PATCH net v2 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create()
https://lore.kernel.org/netdev/8d54b21b-7ca9-4126-ba13-bbd333d6ba0c@xxxxxx/

Regards,
Markus