DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/pfe: fix to set mac_addrs to NULL after freeing
@ 2020-04-07 11:39 wangyunjian
  2020-04-08 14:27 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: wangyunjian @ 2020-04-07 11:39 UTC (permalink / raw)
  To: dev; +Cc: g.singh, akhil.goyal, jerry.lilijun, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@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: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@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;
 	rte_eth_dev_release_port(dev);
 	pfe->nb_devs--;
 }
-- 
2.19.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/pfe: fix to set mac_addrs to NULL after freeing
  2020-04-07 11:39 [dpdk-dev] [PATCH v1] net/pfe: fix to set mac_addrs to NULL after freeing wangyunjian
@ 2020-04-08 14:27 ` Ferruh Yigit
  2020-04-09  1:12   ` wangyunjian
  0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2020-04-08 14:27 UTC (permalink / raw)
  To: wangyunjian, dev
  Cc: g.singh, akhil.goyal, jerry.lilijun, xudingke, stable, Hemant Agrawal

On 4/7/2020 12:39 PM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@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: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@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'?

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/pfe: fix to set mac_addrs to NULL after freeing
  2020-04-08 14:27 ` Ferruh Yigit
@ 2020-04-09  1:12   ` wangyunjian
  0 siblings, 0 replies; 3+ messages in thread
From: wangyunjian @ 2020-04-09  1:12 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: g.singh, akhil.goyal, Lilijun (Jerry), xudingke, stable, Hemant Agrawal



> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Wednesday, April 8, 2020 10:28 PM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: g.singh@nxp.com; akhil.goyal@nxp.com; Lilijun (Jerry)
> <jerry.lilijun@huawei.com>; xudingke <xudingke@huawei.com>;
> stable@dpdk.org; Hemant Agrawal <hemant.agrawal@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 <wangyunjian@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: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@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--;
> >  }
> >


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-09  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 11:39 [dpdk-dev] [PATCH v1] net/pfe: fix to set mac_addrs to NULL after freeing wangyunjian
2020-04-08 14:27 ` Ferruh Yigit
2020-04-09  1:12   ` wangyunjian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).