From patchwork Tue Oct 24 15:51:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 116955 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5912763qgn; Tue, 24 Oct 2017 08:05:41 -0700 (PDT) X-Google-Smtp-Source: ABhQp+S42Er8D3E90SFpgXWe/vbtEnELElO7dXyYV/AKRMWeYWxSdDbT9FxAqwbnY6HP9kRB761Q X-Received: by 10.159.208.5 with SMTP id a5mr13412721plp.436.1508857541450; Tue, 24 Oct 2017 08:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508857541; cv=none; d=google.com; s=arc-20160816; b=c7Z4LYZ4yya5zTfmaceyaHbV7pnQFHXYM9qt1w9kt0Lbj3+nIFyi2nfn7gfATcK4yT vjU7aU1GZaeXOAWwNX0vujNcHp7N2GXYUJhTUXLrfTOgJvTSJM+9b9JLqX79HTv4wyZV UlX08atjAAeQq2mvZBHjmbYA53uO4DNLmeyAShiA8+DMCKHUzs1aH+ZWjSIvfIGEzK7s qF6fD9BV4+7CLmkCPsxaAOmJMdSTKjqSXs40vrETrrTTcmVaTSEUCpgUEchArTu7tquJ 4lSSc9NumiAah7Un905L1ta/lYT018qaVX6M/A3pcf5zlnkUEtkO6NVJClXexHxQ5yzg 3e0Q== 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:arc-authentication-results; bh=znGSUMCsslPLPaOESRHCC+54ePNDf8SM7Qfb/SswhPA=; b=gLmZWPrJwRBgHLMvip9TMV0r/wn8rMn8cEJMbe9AVZohxsU006oQ5DlqIIp4MVTd6O cz15TewwkahyVvWYHZO9eTh2MnJ+6RwccJpcAxYyCxLQdpy24MqQAeBkv2V4Viamx4cK sMDXXGBSbMEnjkjy39AVl4+f99v+wT2rJBTat3DFD9vNVBKn/m/gG9YbvZZbRZQYyctC ws01G0ITZII229AObmPSxj5SdaAxT42BgNTZybEfD99Z/37YamAPL2QSDu0sxtamZvtE 4jnlBLY3O5+K29jY1/t4FlucFmT0jW2Z/PS19kgLYDTVe+o4bD5youTZRvZbeqwjPGwR NRSg== 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 78si324538pfi.520.2017.10.24.08.05.41; Tue, 24 Oct 2017 08:05:41 -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 S932335AbdJXPFj (ORCPT + 27 others); Tue, 24 Oct 2017 11:05:39 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50597 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932206AbdJXPFb (ORCPT ); Tue, 24 Oct 2017 11:05:31 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 7A0F63C483AC9; Tue, 24 Oct 2017 23:05:23 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Tue, 24 Oct 2017 23:05:17 +0800 From: John Garry To: , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 07/19] scsi: hisi_sas: fix NULL check in SMP abort task path Date: Tue, 24 Oct 2017 23:51:37 +0800 Message-ID: <1508860309-212397-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508860309-212397-1-git-send-email-john.garry@huawei.com> References: <1508860309-212397-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan This patch adds a NULL check of task->lldd_task before freeing the slot in SMP path. This is to guard against the scenario of the slot being freed during the from the preceding internal abort. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 88d90dc..2a209e1 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1161,7 +1161,7 @@ static int hisi_sas_abort_task(struct sas_task *task) rc = hisi_sas_internal_task_abort(hisi_hba, device, HISI_SAS_INT_ABT_CMD, tag); - if (rc == TMF_RESP_FUNC_FAILED) { + if (rc == TMF_RESP_FUNC_FAILED && task->lldd_task) { spin_lock_irqsave(&hisi_hba->lock, flags); hisi_sas_do_release_task(hisi_hba, task, slot); spin_unlock_irqrestore(&hisi_hba->lock, flags);