Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2500196imm; Mon, 24 Sep 2018 05:31:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV63LnvS8gnHkFQOZOWEvfjtKcdquOKnozC28ar8Un62Y1c20eQtJ8Ta9F3BtPcAOXEZDLWLk X-Received: by 2002:a17:902:1681:: with SMTP id h1-v6mr10417250plh.262.1537792312548; Mon, 24 Sep 2018 05:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792312; cv=none; d=google.com; s=arc-20160816; b=Wqp8ElShPDLXJHHW5QLtQJr3bmw/mm4vxfq8Asnk7v77gvw9KfBqdE9et13XaXZY8G diDkznL4xmpBIIHvA0ttv52RP5BQ1L4FLB4R3fLOb+f3270OqfWD6+1HJ0YjSstc6YIX ycdS++QQUGCRbcXe/BLzLpYxxsy7LlUajAmtjnJDqZ/N9VMvZLhovTTbahTTEpCBvMpx 6GqCWBJ2C3NyNW6s7ay41EYiT3Rq0AexCpPnspyXNzrflYR/BGM0g/ka/tQtGh6qAtJa rTYPw5Q98NhORghmbM22or7CQ169mFjIg9NntzltfzqB3qkBPhAdk92+CZTGSJJymTi6 H2sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=0V7JDj374oNIZGhoa2HGxxltZZJZdJ8F/Qy1x+bjPP0=; b=t5rf3LiUUHTdepYUlkjeXacmHAiX4ds91y+88Rx4eJmCziFsPD9YRZjcQitAK9yBHi GqeOy1rUy2JtkCEnhyZ14X4pARZRIxpWnelbmYu6d+WgMiJM4r7UovzlGcvKoHZ3H6tY 518A5tLi3vMAEUV8ly7wsw+WvQA+jYalqzw6BBpKTvdJCFh+P3REGhhdXFyfGPhqU/wd 7FusAbeVj8GJEQYIRZ2HIzONrz1opp1XWRFN5MM0nsIjPTVmx/z7YwW45Lt/9feld23V IdH2Cze4kGEgIuinzesLGDPsG1zXtKQk8PzU+c3YZMhQc2E6QZuS34MbUNDErcQ2Tj3s TwfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11-v6si736605pgm.572.2018.09.24.05.31.37; Mon, 24 Sep 2018 05:31:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387693AbeIXSbK (ORCPT + 99 others); Mon, 24 Sep 2018 14:31:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57572 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732800AbeIXSbK (ORCPT ); Mon, 24 Sep 2018 14:31:10 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 210811018; Mon, 24 Sep 2018 12:29:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Morgenstein , Daniel Jurgens , Saeed Mahameed Subject: [PATCH 4.18 009/235] net/mlx5: Fix debugfs cleanup in the device init/remove flow Date: Mon, 24 Sep 2018 13:49:55 +0200 Message-Id: <20180924113105.245339495@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jack Morgenstein [ Upstream commit 5df816e7f43f1297c40021ef17ec6e722b45c82f ] When initializing the device (procedure init_one), the driver calls mlx5_pci_init to perform pci initialization. As part of this initialization, mlx5_pci_init creates a debugfs directory. If this creation fails, init_one aborts, returning failure to the caller (which is the probe method caller). The main reason for such a failure to occur is if the debugfs directory already exists. This can happen if the last time mlx5_pci_close was called, debugfs_remove (silently) failed due to the debugfs directory not being empty. Guarantee that such a debugfs_remove failure will not occur by instead calling debugfs_remove_recursive in procedure mlx5_pci_close. Fixes: 59211bd3b632 ("net/mlx5: Split the load/unload flow into hardware and software flows") Signed-off-by: Jack Morgenstein Reviewed-by: Daniel Jurgens Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -874,8 +874,10 @@ static int mlx5_pci_init(struct mlx5_cor priv->numa_node = dev_to_node(&dev->pdev->dev); priv->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), mlx5_debugfs_root); - if (!priv->dbg_root) + if (!priv->dbg_root) { + dev_err(&pdev->dev, "Cannot create debugfs dir, aborting\n"); return -ENOMEM; + } err = mlx5_pci_enable_device(dev); if (err) { @@ -924,7 +926,7 @@ static void mlx5_pci_close(struct mlx5_c pci_clear_master(dev->pdev); release_bar(dev->pdev); mlx5_pci_disable_device(dev); - debugfs_remove(priv->dbg_root); + debugfs_remove_recursive(priv->dbg_root); } static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)