Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4026212rwj; Tue, 20 Dec 2022 05:16:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4CS4CQ5PHDsFyQEOt65B25BYR7SBDUPiWP70ekP8vNojfu4FNFndkn5wwfuDYQ8dOWyc/o X-Received: by 2002:a17:902:f14c:b0:18f:ac9f:2a02 with SMTP id d12-20020a170902f14c00b0018fac9f2a02mr29007887plb.10.1671542196580; Tue, 20 Dec 2022 05:16:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671542196; cv=none; d=google.com; s=arc-20160816; b=xdPED60x5YOYdv8eg6w8qzbld0EG2WZ6KE0Vc3zF3dFbF1cCwb7jc/YNluoXl9EcIX WUyh/e6GzCTpij5x9QO2+/bVXgW075srU/61rxVNlrvbsGdFu5bBUmUcQjsUEJKcqIK1 O1tSqelDMkACd1SULcgK1mHdDyISDzAryOJB38Xrg+ImjlTe6Tu9zifEYBwyzC1wILR1 81oQv3jQR+87l/0ouBr9TsZyEOpKYZeopKtG1htC+OEeRruvLVykpdZ0t+2trfHUvzmH VqlS2Yiw/lZGAv+lNeZ26lhgYpzXI42hYrXuHDyJazm6dRB1kU6QayylDx93YUEvmuZn A9ew== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a170903248500b0018948b0082fsi12931792plw.244.2022.12.20.05.16.27; Tue, 20 Dec 2022 05:16:36 -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 + 70 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 Content-Type: text/plain 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 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 --- 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); -- 2.17.1