From patchwork Tue Dec 20 12:53:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangxingui X-Patchwork-Id: 35078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2951190wrn; Tue, 20 Dec 2022 05:03:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4xvx3HvNYbqxvwe3a7RX+jsYQczBQc0YFF8IRB0XhKDITSaJibeuBMtEr3MWR5M15nJ3YQ X-Received: by 2002:a05:6a21:78aa:b0:af:7774:4de4 with SMTP id bf42-20020a056a2178aa00b000af77744de4mr38155762pzc.22.1671541433888; Tue, 20 Dec 2022 05:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671541433; cv=none; d=google.com; s=arc-20160816; b=tT1A9xBGLUcVOOwFtU4JTN7PtKNMEGTLaI9m1Y5enVep8v73D2nTKedd6aUWealYyj Haa+sT9WWrfCxwRwRzMRs6fyh5Nw6U9Y3XSE3gRt4k1bRNMM6BWBUR7tgxWkQqmNvVtN 5sEn3wbihWkNxFb/Iu+fTZctpwuVYMsKmlWJcMB+PectT+FyHxpNvIc4evHk70GsLDDP crfpL3EgEH1a6JDx0dWNKue0ICx8KDMxN7vSY5bCkP4hM3eIvgNZrzxouPWs2BINjOkM MwWov/hbM0qHhQUWSGK8kJmCNuTEKfgO9bB5lKvPqyYgN9F4Nd0UrDnwYsYpgWyJM5b3 ycsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=w3mTkAx4XqteeLjriGSryAuendUiyLbrCWT3xKmkUNQ=; b=VdKpc/fmL8kQdODLYSWOUduJmqaCZI25x3yanGyORiEA9OCUgDwnOsTCMTIUYP60kF W4lsjGgLec0tn4QI5wBeAAtrcJ+Cfxn5Qd0Dz5lhtWtWa+aiG1ITZh0An+czDzgRmmrp 2kB8P5DepAc0rjzxsL2vpt5l0wtHxYyijjU9vc/2XiPpFtQdIx7hCmQ0fAnQx5NgP5zc pBT1juqGszL3g39rjgaCrRrjCmzOqE7Y6QAeRtuv1TfKnOqGQthm8+Kke6FtP8S365RC Rt7VyVH/otBvMG5BT9jznqYW3sdKrjx61Rsx2rdisKyqge8uhb+TK96qJwsrtuZbPTMV ROEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j63-20020a638b42000000b00477f864cf87si13938148pge.24.2022.12.20.05.03.40; Tue, 20 Dec 2022 05:03:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233739AbiLTNAi (ORCPT + 99 others); Tue, 20 Dec 2022 08:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230189AbiLTNA2 (ORCPT ); Tue, 20 Dec 2022 08:00:28 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36C35DEE7; Tue, 20 Dec 2022 05:00:27 -0800 (PST) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NbxVC0T72zmWkd; Tue, 20 Dec 2022 20:59:15 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpemm500012.china.huawei.com (7.185.36.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 20 Dec 2022 21:00:21 +0800 From: Xingui Yang To: , , CC: , , , , , Subject: [PATCH] scsi: libsas: Grab the host lock in sas_ata_device_link_abort() Date: Tue, 20 Dec 2022 12:53:49 +0000 Message-ID: <20221220125349.45091-1-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500012.china.huawei.com (7.185.36.89) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752738230986275164?= X-GMAIL-MSGID: =?utf-8?q?1752738230986275164?= Grab the host lock in sas_ata_device_link_abort() before calling ata_link_abort(), as the comment in ata_link_abort() mentions. Signed-off-by: Xingui Yang Reviewed-by: John Garry --- drivers/scsi/libsas/sas_ata.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index f7439bf9cdc6..4f2017b21e6d 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -889,7 +889,9 @@ void sas_ata_device_link_abort(struct domain_device *device, bool force_reset) { struct ata_port *ap = device->sata_dev.ap; struct ata_link *link = &ap->link; + unsigned long flags; + spin_lock_irqsave(ap->lock, flags); device->sata_dev.fis[2] = ATA_ERR | ATA_DRDY; /* tf status */ device->sata_dev.fis[3] = ATA_ABORTED; /* tf error */ @@ -897,6 +899,7 @@ void sas_ata_device_link_abort(struct domain_device *device, bool force_reset) if (force_reset) link->eh_info.action |= ATA_EH_RESET; ata_link_abort(link); + spin_unlock_irqrestore(ap->lock, flags); } EXPORT_SYMBOL_GPL(sas_ata_device_link_abort);