From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH] net/mlx5: fix verification of device context Date: Wed, 26 Jul 2017 14:55:11 +0200 Message-ID: <20170726125511.GE11154@bidouze.vm.6wind.com> References: <5ec0604196fb087a42fa75e6ddc2a04aab293593.1501047767.git.shacharbe@mellanox.com> <20170726090613.GT19852@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Adrien Mazarguil , "dev@dpdk.org" , =?iso-8859-1?Q?N=E9lio?= Laranjeiro , Shahaf Shuler To: Shachar Beiser Return-path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id C717E7CA9 for ; Wed, 26 Jul 2017 14:55:21 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id t201so71803513wmt.1 for ; Wed, 26 Jul 2017 05:55:21 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Shachar, On Wed, Jul 26, 2017 at 09:21:27AM +0000, Shachar Beiser wrote: > Hi , > > When I say close I mean : " mlx5_dev_close" . This function set the priv->ctx to NULL. > We think this patch is required because we have an open bug of seg fault while accessing priv->ctx == NULL. > > -Shachar Beiser. > This patch does not fix the root cause of the issue. It is a bug in the ether layer, and missing flags within MLX5 PMD. So NACK on this patch, I will send shortly the proper fix. Best regards, > > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Wednesday, July 26, 2017 12:06 PM > To: Shachar Beiser > Cc: dev@dpdk.org; Nélio Laranjeiro ; stable@dpdk.org > Subject: Re: [PATCH] net/mlx5: fix verification of device context > > Hi Shachar, > > On Wed, Jul 26, 2017 at 05:43:24AM +0000, Shachar Beiser wrote: > > Get interface name function lacks verification of device context. > > It might lead to segmentation fault when trying to query the name > > after the device is closed.fixing it by adding the missing > > verification > > > > Thanks, however if by "close" you mean it may occur when applications use ethdev callbacks after a call to rte_eth_dev_close(), I do not think PMDs have to protect themselves against bad application behavior, otherwise there is no end to such fixes. > > The reverse of rte_eth_dev_close() is not rte_eth_dev_configure() nor any other ethdev callback (see documentation), but a bus probe operation. > > Perhaps I've missed something, so in case a crash occurs *while* calling > rte_eth_dev_close() I guess this patch is fine, but then please describe the reason. > > > Fixes: cd89f22a1e9770 ("net/mlx5: remove unused interface name query") > > This commit doesn't look like the root cause of that issue? > > > Cc: stable@dpdk.org > > > > Signed-off-by: Shachar Beiser > > --- > > drivers/net/mlx5/mlx5_ethdev.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > > b/drivers/net/mlx5/mlx5_ethdev.c index b70b7b9..6e67461 100644 > > --- a/drivers/net/mlx5/mlx5_ethdev.c > > +++ b/drivers/net/mlx5/mlx5_ethdev.c > > @@ -173,6 +173,10 @@ struct priv * > > char match[IF_NAMESIZE] = ""; > > > > { > > + if (priv->ctx == NULL) { > > + DEBUG("The device is closed, cannot query interface name "); > > + return -1; > > + } > > MKSTR() is at the beginning of this block because it defines a new variable (path). For coding style consistency you should not put any code before variable declarations, or at least insert an empty line between them. Otherwise you could move this check to the parent block. > > > MKSTR(path, "%s/device/net", priv->ctx->device->ibdev_path); > > > > dir = opendir(path); > > -- > > 1.8.3.1 > > > > I think this patch is not necessary unless proved otherwise, have you > actually observed a crash addressed by it? > > -- > Adrien Mazarguil > 6WIND -- Gaëtan Rivet 6WIND