[dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check

wangyunjian wangyunjian at huawei.com
Sat Mar 27 02:50:49 CET 2021


> -----Original Message-----
> From: Slava Ovsiienko [mailto:viacheslavo at nvidia.com]
> Sent: Friday, March 26, 2021 9:24 PM
> To: wangyunjian <wangyunjian at huawei.com>; dev at dpdk.org
> Cc: Matan Azrad <matan at nvidia.com>; Shahaf Shuler <shahafs at nvidia.com>;
> Lilijun (Jerry) <jerry.lilijun at huawei.com>; chenchanghu
> <chenchanghu at huawei.com>
> Subject: RE: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before null check
> 
> > -----Original Message-----
> > From: wangyunjian <wangyunjian at huawei.com>
> > Sent: Friday, March 26, 2021 12:37
> > To: dev at dpdk.org
> > Cc: Matan Azrad <matan at nvidia.com>; Shahaf Shuler
> > <shahafs at nvidia.com>; Slava Ovsiienko <viacheslavo at nvidia.com>;
> > jerry.lilijun at huawei.com; chenchanghu at huawei.com; Yunjian Wang
> > <wangyunjian at huawei.com>
> > Subject: [dpdk-dev] [PATCH] net/mlx5: fix using flow tunnel before
> > null check
> >
> > From: Yunjian Wang <wangyunjian at 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 at huawei.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo at 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 at 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



More information about the dev mailing list