> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yi...@intel.com]
> Sent: Wednesday, April 8, 2020 10:28 PM
> To: wangyunjian <wangyunj...@huawei.com>; dev@dpdk.org
> Cc: g.si...@nxp.com; akhil.go...@nxp.com; Lilijun (Jerry)
> <jerry.lili...@huawei.com>; xudingke <xudin...@huawei.com>;
> sta...@dpdk.org; Hemant Agrawal <hemant.agra...@nxp.com>
> Subject: Re: [dpdk-dev] [PATCH v1] net/pfe: fix to set mac_addrs to NULL after
> freeing
> 
> On 4/7/2020 12:39 PM, wangyunjian wrote:
> > From: Yunjian Wang <wangyunj...@huawei.com>
> >
> > It does not correctly set the mac_addrs variable to NULL after freeing
> > it, which will lead to a double free.
> >
> > Fixes: 67fc3ff97c39 ("net/pfe: introduce basic functions")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunj...@huawei.com>
> > ---
> >  drivers/net/pfe/pfe_ethdev.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/pfe/pfe_ethdev.c
> > b/drivers/net/pfe/pfe_ethdev.c index 940347819..ba0f8dd3f 100644
> > --- a/drivers/net/pfe/pfe_ethdev.c
> > +++ b/drivers/net/pfe/pfe_ethdev.c
> > @@ -397,6 +397,7 @@ pfe_eth_exit(struct rte_eth_dev *dev, struct pfe
> *pfe)
> >     pfe_eth_close_cdev(dev->data->dev_private);
> >
> >     rte_free(dev->data->mac_addrs);
> > +   dev->data->mac_addrs = NULL;
> 
> Why not remove 'rte_free(dev->data->mac_addrs);', since
> 'rte_eth_dev_release_port()' does free the 'mac_addrs'?
> 

Thanks for your suggestion, will send the v2 later.

Yunjian

> >     rte_eth_dev_release_port(dev);
> >     pfe->nb_devs--;
> >  }
> >

Reply via email to