From patchwork Fri Feb 24 21:37:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9591257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AAF23601AE for ; Fri, 24 Feb 2017 21:38:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AF4328947 for ; Fri, 24 Feb 2017 21:38:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FD6F2895A; Fri, 24 Feb 2017 21:38:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30B2128947 for ; Fri, 24 Feb 2017 21:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397AbdBXVii (ORCPT ); Fri, 24 Feb 2017 16:38:38 -0500 Received: from mail-bn3nam01on0088.outbound.protection.outlook.com ([104.47.33.88]:6432 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751327AbdBXVi1 (ORCPT ); Fri, 24 Feb 2017 16:38:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3VxKEh8Q43CTbgc3veSQLFoQ9lbtlem3w0CdzIWtbbI=; b=hOLHJmN545uuDM52U0OJkLKGKPmLSdiCO9Rdek0XIHx1I2V8s1P9At8Nk2AozhFLKNB4JtZ3xm7jcAKVBoqfV27dFHiBrJ7byQKwIP/DYQaQG2Ovg5MLXU3AKyLPrdXfiEghKKAchlYImMaom/ehfBG9P9oVyz+Td/Pnkfq8M5Y= Received: from CO2PR07CA0004.namprd07.prod.outlook.com (10.141.194.142) by BN3PR07MB2626.namprd07.prod.outlook.com (10.167.5.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Fri, 24 Feb 2017 21:38:03 +0000 Received: from BY2FFO11FD004.protection.gbl (2a01:111:f400:7c0c::157) by CO2PR07CA0004.outlook.office365.com (2a01:111:e400:1414::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12 via Frontend Transport; Fri, 24 Feb 2017 21:38:03 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; linux-iscsi.org; dkim=none (message not signed) header.d=none; linux-iscsi.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2FFO11FD004.mail.protection.outlook.com (10.1.14.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.919.10 via Frontend Transport; Fri, 24 Feb 2017 21:38:02 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.309.2; Fri, 24 Feb 2017 13:37:46 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id v1OLbj26003868; Fri, 24 Feb 2017 13:37:45 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v1OLbjOI003867; Fri, 24 Feb 2017 13:37:45 -0800 From: Himanshu Madhani To: , , CC: , , Subject: [PATCH v3 11/14] qla2xxx: Fix inadequate lock protection for ABTS. Date: Fri, 24 Feb 2017 13:37:40 -0800 Message-ID: <1487972263-3795-12-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487972263-3795-1-git-send-email-himanshu.madhani@cavium.com> References: <1487972263-3795-1-git-send-email-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(2980300002)(428002)(189002)(199003)(5003940100001)(107886003)(38730400002)(626004)(356003)(305945005)(92566002)(86362001)(76176999)(50986999)(2201001)(4326007)(36756003)(1691005)(47776003)(2906002)(6666003)(48376002)(80596001)(106466001)(69596002)(33646002)(101416001)(2950100002)(105586002)(42186005)(50466002)(81166006)(54906002)(189998001)(5660300001)(8656002)(50226002)(4720700003)(8936002)(8676002)(81156014)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2626; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD004; 1:/oZ/W2Loe2I+kbl3ODNShv3YVEft4h+MdNIZ7K6jj36Pgwz8+sfwP9P/Ty5lH6rz4yILF+R0Fj0bWtgeXbT/OWj+op1HfeS+xxtOJd+LQdDFlQujkQ+7FrQ4RMp6yl7n3lOs43idhswGKM/wBO6p+At0F+MyvQAIlHn/f8FK4ttQ6Zg7y7dHG0ayrZcYxktanZTSR51bxozvNUZYUO5lWd8ki89ADfsymoYTwska0X05GFTTUPzVxTWmNMiZyiTGQdcYrzWu2R+rWe+Hdmmg5JASen4MiShsPH3fx73kzLYksMsZ89kI0OXEAGB1GkzY8Zgb+0zavR2+ZVKs60OZPDA/drDNd8Y8OA6i0xIspemAJJc/c40Ngui4yQf4xrMPO+/5s1zAVCowPZmrwpcghNsiPr5jH57IZIZTkrmnh/+v8p2pR7dqtrUDfAt0rS7d5uvsIOhtWGos7Nt5ygXfiyNIxGgOaA6nY4qNgBXeNazCHGTyYidPwBQ6943z49yF15wVXWiiLV7Qont+BZSB+M1CZcgSE3eVxCnK5pneKTM= X-MS-Office365-Filtering-Correlation-Id: eaff9c4a-7ad7-4a61-0975-08d45cfd6926 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR07MB2626; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2626; 3:kzDkjhpUSEdnMcr45p+AEfPhtjq76IC2S+Jv2W8Gk0ryRj+lcX3YpCxPmU/vRCDvW+lgBmWc+mYRWWikryQK0Y01lMBdYXPtXJi64TEFeCvtDUcwFwwNkHwUXtQSy7wCfU7dS+8Lf2ru5jiqubLJbUhMWzJhOgT6aDnjT9ds2yx2KQnOEyygSHfExGqOaDj8rPWSao2KjWQ/qQAgX6rmpIpTZhgHVBlxEPBBy/UnREOW/U4D3/KjvoaFE22+UWz8WD1r3K7LbT6sE1gEUQ6wg06P68ZWB3bwKAozYv08mMR/KWimiPjRybARcLQgo1d7yDlkyhqtTliV860Ax9VnmzKkmzY9EkLa0iWCxnZsefpIrPu+EeUIkC2ZCzqMKPw/; 25:H5P9fQ9QNv39xT+aA3RLYLs4s3VCMfvE/5KzkPpStOhS7q++xqSoAK0gF2ThEJSlQgddWJDAQ0priGbEf0QpX9QRu8CypDuyd9mzCyDvMlWbzrSt/QvfrtKcyogLQQhwurPCu8/Ek4XJR7ND2GYPtVpTSUnHfOaaF+0TC/FqfSp4ClsbiBn7XAIdQkf9rsJPeXSONLdcqRK3RIW9hRTxMxHhNRsWdBhI6FdFSS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-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13015025)(8121501046)(5005006)(13017025)(13023025)(13024025)(13018025)(10201501046)(3002001)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(6072148); SRVR:BN3PR07MB2626; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2626; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2626; 4:aY042iU9aftA+XbaaPyCLy4Ypi+efp+hUvoGbH0jywnMRo+vUJa+/O3uUF2zLoX633qEkN0m0ONh6EB09FsJQvu50PXMWm/uJ5L1SPv+a3P4/LETPENiPEyq/59/9EsIE8e/dj9qndofBn5YMmLDFZuOcIIFfiZzcwyzpCOXx0E/itFUV6UzfAOinuQ4J0ovPCLlIZWHzDcUo7OrjpTxupGb1W7qL5dqTt+0ZlysCKZYbJc78lsmBvY5LVmDz08MDl6IBUhZm0arND9xxi05/3w2P9LtlAv6hvWuuiO6vW8kexsVabDrt6MaZ4QU1H74vNWCxnCrCI1tTJaFHBH1XpI1kQLVASEp7abTUSR0hpTKeZYSO7LRRDQ+PYeXnRGxh4STKB9WUxMh7tGJgCNFZoXg5Vi8Dh9S3z3gCrHxVA0lvmNy00wajKkw64BzcXnGxDXTMrFBcN9IUXxAZgiS2xo9JvNYRf7j9B3WSfMgJd2GothgqQimCnPtchLAIHWSb+zLzTJ8dsovZb0f6bQACx1Of/mgZhtkx4ABj0SVCZQS8QNTtryTSzLU0waoq+QGSxNbmlxF7rlOfytpUEMLM3OPtjEuy19yUDDVZE9ReEaPa33Prn2fgi0r6b+FzhZYVk7/W/hnh5y8IKMnp1gHpv8BflV48Xk8RKUYRYOILkStF0LzGWhU1l0Y+z63nBzwHDzhRUAa8yrYvQNfobQEY3Zwmt3nOyIASeahg8fVJSxQo2NpWHMU4UrOf/GV/cbj X-Forefront-PRVS: 0228D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ticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2626; 7:IP5YLlNNMbG89BCJWdLt5eR4wKj21ECIsngcUbOjZlmnw9VCRCUpLGAL9HmxBd7Ba13aCMKXa+S+cNVQHGf8VfY90G0/gxkoDSqAE/FS1jvpi2aTCCfKdKvCvwM4c/VTGjKf5Tx05ffwB5xYYKs5rymWntChx9kdCe4jXJ2JXYr4Pi65FM1v6mxEaJwcj/ypVAEizcwBzpU1ng0aW2Kog5RGHVxbvO7otcBs3CXgNNmr5BlC3wKdQy1+wDsS6yX6KVEDC+HPXje5OjFWoibgceoMreB8YYlJXd+Col83eQXkxClXp5Mpsb+7gsUPPQfvQnc0KhQk+Drvgfsd86ngAg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2017 21:38:02.4480 (UTC) X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2626 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran Normally, ABTS is sent to Target Core as Task MGMT command. In the case of error, qla2xxx needs to send response, hardware_lock is required to prevent request queue corruption. Cc: Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index b5864e5..b751eb6 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -130,6 +130,9 @@ static void qlt_send_term_imm_notif(struct scsi_qla_host *vha, static struct fc_port *qlt_create_sess(struct scsi_qla_host *vha, fc_port_t *fcport, bool local); void qlt_unreg_sess(struct fc_port *sess); +static void qlt_24xx_handle_abts(struct scsi_qla_host *, + struct abts_recv_from_24xx *); + /* * Global Variables */ @@ -405,6 +408,8 @@ static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, (struct abts_recv_from_24xx *)atio; struct scsi_qla_host *host = qlt_find_host_by_vp_idx(vha, entry->vp_index); + unsigned long flags; + if (unlikely(!host)) { ql_dbg(ql_dbg_tgt, vha, 0xffff, "qla_target(%d): Response pkt (ABTS_RECV_24XX) " @@ -412,9 +417,12 @@ static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, vha->vp_idx, entry->vp_index); break; } - qlt_response_pkt(host, (response_t *)atio); + if (!ha_locked) + spin_lock_irqsave(&host->hw->hardware_lock, flags); + qlt_24xx_handle_abts(host, (struct abts_recv_from_24xx *)atio); + if (!ha_locked) + spin_unlock_irqrestore(&host->hw->hardware_lock, flags); break; - } /* case PUREX_IOCB_TYPE: ql2xmvasynctoatio */