DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
@ 2021-03-26  9:37 wangyunjian
  2021-03-26 13:23 ` Slava Ovsiienko
  2021-03-27  2:44 ` [dpdk-dev] [PATCH v2] " wangyunjian
  0 siblings, 2 replies; 5+ messages in thread
From: wangyunjian @ 2021-03-26  9:37 UTC (permalink / raw)
  To: dev; +Cc: matan, shahafs, viacheslavo, jerry.lilijun, chenchanghu, Yunjian Wang

From: Yunjian Wang <wangyunjian@huawei.com>

Coverity flags that 'ctx->tunnel' variable is used before
it's checked for NULL. This patch fixes this issue.

Coverity issue: 366201
Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread protection")

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/mlx5/mlx5_flow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d46fc333d1..bb8d09cdef 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -7899,10 +7899,11 @@ static void get_tunnel_miss(struct rte_eth_dev *dev, void *x)
 
 	rte_spinlock_unlock(&thub->sl);
 	ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel);
-	ctx->tunnel->refctn = 1;
 	rte_spinlock_lock(&thub->sl);
-	if (ctx->tunnel)
+	if (ctx->tunnel) {
+		ctx->tunnel->refctn = 1;
 		LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain);
+	}
 }
 
 
-- 
2.23.0


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
  2021-03-26  9:37 [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check wangyunjian
@ 2021-03-26 13:23 ` Slava Ovsiienko
  2021-03-27  1:50   ` wangyunjian
  2021-03-27  2:44 ` [dpdk-dev] [PATCH v2] " wangyunjian
  1 sibling, 1 reply; 5+ messages in thread
From: Slava Ovsiienko @ 2021-03-26 13:23 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: Matan Azrad, Shahaf Shuler, jerry.lilijun, chenchanghu

> -----Original Message-----
> From: wangyunjian <wangyunjian@huawei.com>
> Sent: Friday, March 26, 2021 12:37
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> jerry.lilijun@huawei.com; chenchanghu@huawei.com; Yunjian Wang
> <wangyunjian@huawei.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null
> check
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> Coverity flags that 'ctx->tunnel' variable is used before it's checked for NULL.
> This patch fixes this issue.
> 
> Coverity issue: 366201
> Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread
> protection")
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Thank you for the patch. I suppose, this one should be the part of 20.11LTS
either. Could you, please, add "cc: stable@dpdk.org" and send v2?

With best regards, Slava


> ---
>  drivers/net/mlx5/mlx5_flow.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index d46fc333d1..bb8d09cdef 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -7899,10 +7899,11 @@ static void get_tunnel_miss(struct rte_eth_dev
> *dev, void *x)
> 
>  	rte_spinlock_unlock(&thub->sl);
>  	ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel);
> -	ctx->tunnel->refctn = 1;
>  	rte_spinlock_lock(&thub->sl);
> -	if (ctx->tunnel)
> +	if (ctx->tunnel) {
> +		ctx->tunnel->refctn = 1;
>  		LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain);
> +	}
>  }
> 
> 
> --
> 2.23.0


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
  2021-03-26 13:23 ` Slava Ovsiienko
@ 2021-03-27  1:50   ` wangyunjian
  0 siblings, 0 replies; 5+ messages in thread
From: wangyunjian @ 2021-03-27  1:50 UTC (permalink / raw)
  To: Slava Ovsiienko, dev
  Cc: Matan Azrad, Shahaf Shuler, Lilijun (Jerry), chenchanghu

> -----Original Message-----
> From: Slava Ovsiienko [mailto:viacheslavo@nvidia.com]
> Sent: Friday, March 26, 2021 9:24 PM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> Lilijun (Jerry) <jerry.lilijun@huawei.com>; chenchanghu
> <chenchanghu@huawei.com>
> Subject: RE: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
> 
> > -----Original Message-----
> > From: wangyunjian <wangyunjian@huawei.com>
> > Sent: Friday, March 26, 2021 12:37
> > To: dev@dpdk.org
> > Cc: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> > <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> > jerry.lilijun@huawei.com; chenchanghu@huawei.com; Yunjian Wang
> > <wangyunjian@huawei.com>
> > Subject: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before
> > null check
> >
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > Coverity flags that 'ctx->tunnel' variable is used before it's checked for NULL.
> > This patch fixes this issue.
> >
> > Coverity issue: 366201
> > Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread
> > protection")
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> Thank you for the patch. I suppose, this one should be the part of 20.11LTS
> either. Could you, please, add "cc: stable@dpdk.org" and send v2?
> 
> With best regards, Slava

OK, I will send v2 with it.

Yunjian

> 
> 
> > ---
> >  drivers/net/mlx5/mlx5_flow.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow.c
> > b/drivers/net/mlx5/mlx5_flow.c index d46fc333d1..bb8d09cdef 100644
> > --- a/drivers/net/mlx5/mlx5_flow.c
> > +++ b/drivers/net/mlx5/mlx5_flow.c
> > @@ -7899,10 +7899,11 @@ static void get_tunnel_miss(struct rte_eth_dev
> > *dev, void *x)
> >
> >  	rte_spinlock_unlock(&thub->sl);
> >  	ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel);
> > -	ctx->tunnel->refctn = 1;
> >  	rte_spinlock_lock(&thub->sl);
> > -	if (ctx->tunnel)
> > +	if (ctx->tunnel) {
> > +		ctx->tunnel->refctn = 1;
> >  		LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain);
> > +	}
> >  }
> >
> >
> > --
> > 2.23.0


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

* [dpdk-dev] [PATCH v2] net/mlx5: fix using flow tunnel before null check
  2021-03-26  9:37 [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check wangyunjian
  2021-03-26 13:23 ` Slava Ovsiienko
@ 2021-03-27  2:44 ` wangyunjian
  2021-03-28 11:39   ` Raslan Darawsheh
  1 sibling, 1 reply; 5+ messages in thread
From: wangyunjian @ 2021-03-27  2:44 UTC (permalink / raw)
  To: dev
  Cc: matan, shahafs, viacheslavo, jerry.lilijun, chenchanghu,
	Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

Coverity flags that 'ctx->tunnel' variable is used before
it's checked for NULL. This patch fixes this issue.

Coverity issue: 366201
Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread protection")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2:
  add cc: stable@dpdk.org
---
 drivers/net/mlx5/mlx5_flow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d46fc333d1..bb8d09cdef 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -7899,10 +7899,11 @@ static void get_tunnel_miss(struct rte_eth_dev *dev, void *x)
 
 	rte_spinlock_unlock(&thub->sl);
 	ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel);
-	ctx->tunnel->refctn = 1;
 	rte_spinlock_lock(&thub->sl);
-	if (ctx->tunnel)
+	if (ctx->tunnel) {
+		ctx->tunnel->refctn = 1;
 		LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain);
+	}
 }
 
 
-- 
2.23.0


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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix using flow tunnel before null check
  2021-03-27  2:44 ` [dpdk-dev] [PATCH v2] " wangyunjian
@ 2021-03-28 11:39   ` Raslan Darawsheh
  0 siblings, 0 replies; 5+ messages in thread
From: Raslan Darawsheh @ 2021-03-28 11:39 UTC (permalink / raw)
  To: wangyunjian, dev
  Cc: Matan Azrad, Shahaf Shuler, Slava Ovsiienko, jerry.lilijun,
	chenchanghu, stable

Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of wangyunjian
> Sent: Saturday, March 27, 2021 5:44 AM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> jerry.lilijun@huawei.com; chenchanghu@huawei.com; Yunjian Wang
> <wangyunjian@huawei.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix using flow tunnel before null
> check
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> Coverity flags that 'ctx->tunnel' variable is used before
> it's checked for NULL. This patch fixes this issue.
> 
> Coverity issue: 366201
> Fixes: 868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread
> protection")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
> v2:
>   add cc: stable@dpdk.org
> ---

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


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

end of thread, other threads:[~2021-03-28 11:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  9:37 [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check wangyunjian
2021-03-26 13:23 ` Slava Ovsiienko
2021-03-27  1:50   ` wangyunjian
2021-03-27  2:44 ` [dpdk-dev] [PATCH v2] " wangyunjian
2021-03-28 11:39   ` Raslan Darawsheh

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).