From patchwork Tue Nov 12 09:30:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 179174 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7855750ilf; Tue, 12 Nov 2019 01:34:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxyZGjGSEJzBG1WIhhzapOt1kV7DAhRrPcJRsuBb9cIQzo9yd+XifNjEl/yb0JMz5MBI7V1 X-Received: by 2002:aa7:db52:: with SMTP id n18mr30603067edt.169.1573551275807; Tue, 12 Nov 2019 01:34:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573551275; cv=none; d=google.com; s=arc-20160816; b=bWGVAtfJC74bMQZNvp6bC1TsEmvqg1WJ0Ik6JZQSIQblAC34AlM5kQn1JtOyAONn0v vg6iIWHEUAO/h4+FgBFIoUz3+9heJO9Mt4bhKdwHEJkURjgc8D0oJ1Bt6BK31Z2pwABv fp55qTphndbN+/SdSsAFwlVtiKYXpQi9Lv+WPdMlmV+57pHBqgU4HxbuYf6MHxByGsAp o++n3sgEuzgFtbhK0qM89GGgO5qo2ON8d/qm/okvRN0DHsdoNK814en5Y+1ftn1+QUmK dSmAnLqcvaIM34mky8aYSjCHDMRGO27CjUzyL6TkTfQB7L5Hzuk85bZWMhUikrk2fuHR 8wtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=t+O231XlCGuv8osQjKMJ44fWWGG17qzBlwHhBBPM4nU=; b=OK9WbogLmQgVKXt+8uwBCMp/XKKUE7Wm8t/+AYweXUmq2v68kFIDzLy/qjVcClzDZq yexrmJesHxGlXWl5IiRw9ZdbbggL4Z9nJyJYsXU3dqyZlYuNwLfmqr4P8rhPUfoMygyG A5mQr8ta0fDiS6oPh7cgSVFw+VS9YsrJ+GnyHGOAxBbSJ/7hCTMpwUuxBXnmBMrEUNeA 89DN0dky0iNkQUBjmmcRC1WK2k8jBCz4mHliZDvXBmudMliH3fVqMCRehROFGGHkG2rU sQdDgzUASQ3EAqZpow5qoCZMUyjUJD790+j67+jheBI8NCEbVzMhwZ48x7MrdAgk5NCo 1CJA== 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 b19si12780645edb.40.2019.11.12.01.34.35; Tue, 12 Nov 2019 01:34:35 -0800 (PST) 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 S1727151AbfKLJee (ORCPT + 26 others); Tue, 12 Nov 2019 04:34:34 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6205 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727171AbfKLJe1 (ORCPT ); Tue, 12 Nov 2019 04:34:27 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id CF1CF6C0DA9CB716FA85; Tue, 12 Nov 2019 17:34:24 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 12 Nov 2019 17:34:18 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 3/4] scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit() Date: Tue, 12 Nov 2019 17:30:58 +0800 Message-ID: <1573551059-107873-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1573551059-107873-1-git-send-email-john.garry@huawei.com> References: <1573551059-107873-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Currently we call function hisi_sas_debugfs_exit() to remove debugfs_dir before freeing interrupt irqs and destroying workqueue in the driver remove path. If a dump is triggered before function hisi_sas_debugfs_exit() but debugfs_work may be called after it, so it may refer to already removed debugfs_dir which will cause NULL pointer dereference. To avoid it, put function hisi_sas_debugfs_exit() after free_irqs and destroy workqueue when removing hisi_sas driver. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index b7836406debe..bf5d5f138437 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3302,8 +3302,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) struct hisi_hba *hisi_hba = sha->lldd_ha; struct Scsi_Host *shost = sha->core.shost; - hisi_sas_debugfs_exit(hisi_hba); - if (timer_pending(&hisi_hba->timer)) del_timer(&hisi_hba->timer); @@ -3315,6 +3313,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) pci_release_regions(pdev); pci_disable_device(pdev); hisi_sas_free(hisi_hba); + hisi_sas_debugfs_exit(hisi_hba); scsi_host_put(shost); }