From patchwork Wed Jul 26 05:43:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shachar Beiser X-Patchwork-Id: 27192 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 50918374C; Wed, 26 Jul 2017 07:44:20 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id B4C9E2B89 for ; Wed, 26 Jul 2017 07:44:18 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from shacharbe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 26 Jul 2017 08:43:44 +0300 Received: from pegasus08.mtr.labs.mlnx ([10.210.16.114]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v6Q5hiur005453; Wed, 26 Jul 2017 08:43:44 +0300 Received: from pegasus08.mtr.labs.mlnx (localhost [127.0.0.1]) by pegasus08.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id v6Q5hiXR021421; Wed, 26 Jul 2017 05:43:44 GMT Received: (from shacharbe@localhost) by pegasus08.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id v6Q5hhAA021420; Wed, 26 Jul 2017 05:43:43 GMT From: Shachar Beiser To: dev@dpdk.org Cc: Shachar Beiser , Adrien Mazarguil , Nelio Laranjeiro , stable@dpdk.org Date: Wed, 26 Jul 2017 05:43:24 +0000 Message-Id: <5ec0604196fb087a42fa75e6ddc2a04aab293593.1501047767.git.shacharbe@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix verification of device context X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Fixes: cd89f22a1e9770 ("net/mlx5: remove unused interface name query") Cc: stable@dpdk.org Signed-off-by: Shachar Beiser Acked-by: Adrien Mazarguil --- 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(path, "%s/device/net", priv->ctx->device->ibdev_path); dir = opendir(path);