From patchwork Fri Feb 3 22:40:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9555219 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 C1F07602B7 for ; Fri, 3 Feb 2017 22:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE43127F9F for ; Fri, 3 Feb 2017 22:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A327428135; Fri, 3 Feb 2017 22:41:55 +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 43B972815E for ; Fri, 3 Feb 2017 22:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752998AbdBCWlw (ORCPT ); Fri, 3 Feb 2017 17:41:52 -0500 Received: from mail-co1nam03on0074.outbound.protection.outlook.com ([104.47.40.74]:44176 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752995AbdBCWlo (ORCPT ); Fri, 3 Feb 2017 17:41:44 -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=zNpBdj04kZIq3Fz3nokWLM7Q+xBhO5H6oBYF/HD5Dg4=; b=bJHRaV2oac/CtePB321/lqIgzvmZ60SsBcai2ud0TaC4Jkl00HkUlpHjVvHDYc+KjfzdKr3+z45OUijlRcBrSsr9XkK8H5CHxNkYVDc0kzxq9b7XEiEpqKlCbEhSRnX3m5G+UIroCsBmyyEkGNUUqLwmI7z8ZHsV3zWNnftnRa0= Received: from BN6PR07CA0022.namprd07.prod.outlook.com (10.173.33.160) by CO1PR07MB205.namprd07.prod.outlook.com (10.242.167.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Fri, 3 Feb 2017 22:41:42 +0000 Received: from BN1BFFO11FD023.protection.gbl (2a01:111:f400:7c10::1:185) by BN6PR07CA0022.outlook.office365.com (2603:10b6:404:3a::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Fri, 3 Feb 2017 22:41:41 +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 BN1BFFO11FD023.mail.protection.outlook.com (10.58.144.86) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.888.7 via Frontend Transport; Fri, 3 Feb 2017 22:41:41 +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, 3 Feb 2017 14:41:25 -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 v13MfCpZ002380; Fri, 3 Feb 2017 14:41:12 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v13MfCL2002379; Fri, 3 Feb 2017 14:41:12 -0800 From: Himanshu Madhani To: , , , CC: , , Subject: [PATCH v2 11/14] qla2xxx: Fix inadequate lock protection for ABTS. Date: Fri, 3 Feb 2017 14:40:52 -0800 Message-ID: <1486161655-2307-12-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1486161655-2307-1-git-send-email-himanshu.madhani@cavium.com> References: <1486161655-2307-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)(50466002)(105586002)(626004)(5001770100001)(86362001)(2950100002)(5660300001)(47776003)(8936002)(36756003)(1691005)(4720700003)(2906002)(189998001)(2201001)(48376002)(106466001)(38730400001)(101416001)(6666003)(42186005)(69596002)(92566002)(80596001)(33646002)(356003)(4001430100002)(54906002)(4326007)(8656002)(76176999)(305945005)(81166006)(8676002)(81156014)(50226002)(50986999)(5003940100001)(107886002)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO1PR07MB205; 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; BN1BFFO11FD023; 1:GLpMsNMj7742zdnQ1Hi1aV/+ELPh/YMGXtXlEsMnnWh2tCP/8rg2/ddywQnNqCS4ZdOR/IuEyH0l1u7HveAMGhG3qTCS8caDdHATv9dQj8wxh7xsUgHUNewW661L3MWrd3yy0k6GDFNi3zeYCiStHAzUWb1SZRP4t3N2vgXEtArXw+3uFve151DMOAIHP/G1JJRmamrf+u/PUs0LzRxn5B86koPhGqvkKosl8qld2kpGHndVPBuV/hlPITBv/JvQ7i1NDq6w6gzaXzq7jUC12hcysL2J/TS007cWn9OOTbBYU5VCNeT8bkNZbDc5emnpoBalksY9Hasy8EwLz1teWTB7Zwn6W0kMP7108XXgSZyyjFPBe0wS1HaHAcFKLQe94l+WkmnDzcKqyv2GTj4kVKYUClsf4T/i7TuP3wiCFO+hs6zpcw7oHoVKENWFKaVRDMQ3PaJ8HZXkcWqdsFs+OypqMwfnR9roTUtUe069YjBYXHF4dkSGJ6aQsY2XtvuMkp0eer7cT1Cc9HkRJsKxz1+9A9HRThP/HNNTvVDJqS0= X-MS-Office365-Filtering-Correlation-Id: f6196a49-85ff-4ca7-7425-08d44c85d2a3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CO1PR07MB205; X-Microsoft-Exchange-Diagnostics: 1; CO1PR07MB205; 3:izQnZhl223RBB+keHi9SzWUjxQSiVcNmRFns/yqaH7k7kenbuPQOdXf35tNmrSXIXC6CNCfmxUuXaz5mprFe16N2KNwBldvKMq2gHLi+VqT4d9gLM1GB5r4+AKXVSPlie+dd77peP1e+R3BZNOBOH8Odxlq05Sc28nWOjONJeP7ujkbctBRNiCNUpw6YaR/K54aspg8nUMAwfUOQK+RZfEq0r/C9hw2p48ExsNFaoSNR14C03UhLrTYM9Og2VqOjY+K6wa1mEdZx7MSy7i1V5mdoy4uqzIqBsPm8g9EgQrDUdHyNGxcTfGPDq+jxG0o8b4dD5AvnEY4MewJsiiA/wGp+wy22Icmuy6TrpgDEQ4H36q2NUGq23bN9a4p4oDxM; 25:NlpEqyK2Dzw2DSEYORR8YFSsAdKpNMKlr6Fec+Xa8sCeJqXtblY6X7yYfn0+C1qGXTI4akK5ZWjDfoDDZnb1+u+XVWNjsIh2xIEbYPOdq96LOoYCIFKnERjl360oAwbJ1GYkUt36+L0TI3p8SmEeUBDhaC2VAuHD6QjwQat9Dn/nPcGZYnLJ61hwrr/SGT1Q7c+bo3HAHCGCf8q97hkiwnEiHrMo5Y+IL9fYSI6c61k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osfwiDyib9l5YVHaEaUyvm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(13024025)(13015025)(13017025)(13018025)(13023025)(10201501046)(3002001)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123558025)(20161123560025)(6072148); SRVR:CO1PR07MB205; BCL:0; PCL:0; RULEID:; SRVR:CO1PR07MB205; X-Microsoft-Exchange-Diagnostics: 1; CO1PR07MB205; 4:KFkCO2aFaG2xnV5/bpmV6XIU4YVUI5V8xNXK5vc2xGZwE0/8f4G4N40eV3s8osIQSEIAkLOIZ+TTkMEB8I6g63CTs7PO4ExhCne6vH7RR4KltaagX6lq4nfON3TVYFbtfU9ryEkHdcoRsPb69o3+Ae1nSxSynGCJsSuJUAfIcLiBJILQkIf6ZMpg6AegtVt2tHF94nUFhjK+sGyiEARIWDj8OPaaZdNDmXuWNgnbiwlwfmlEJrtInA4T18SnG7J2bN7dmmTKTvPyTaor5JjR7HmQQFjxRRhMr8F1FYq8a+75bWgQqsSHtnZ1I94h8Cv40HV0ZfJEZm11QqVMkelgX8j5gxbvGmtVuPvN+brGoSj2uJnJD2lGrnbwytT5evePjbV67J3bQ8zf7/661EF87SbxX94ENtgHLcOWZyidsBODe3i6+/lIjbDqO4P3zGAI6PCzzLPMwvqG0nJU7FZUq3skLmTLqfVORsm5E+rBxFGaTZqdqrPjsnVveBmGQocRg1kOo6YT6/o9qDWOQQqP4/nyOfjSvyP9ppL8/B/rr6iwsyIC7b/mAahD76Lu2Do+Juty2INOkgAymwQ2rEtcrTNLAl8ROfelbPz83q1f8Q1sWUu0Qb2mlmBD8EDikLzXAgOSiXkn1pn6On+dnTZ5CQZvGGedASjk67AMFvMdUxJjkC/WQvgDrMpx9zrc4kXRHSrw519h7tyQgsOc/SVKjA== X-Forefront-PRVS: 02070414A1 X-Microsoft-Exchange-Diagnostics: =?us-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S0FUFoCrxXMGE7kG59J5tmFJEgD0uhBkay6nySJQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO1PR07MB205; 7:T9CNqpw+9ndRYPUYt0EPEcs5zFgX4wrpZeXPjok3PyK8dQVVs7IhvjCcBJWIBqeQBeIabOdrD7o4cEllIjDuuGKVJreN1QmsEjIHRU0Hjuy2h2w6FWsj4ZSvp6tqR7TEe/s/LHN5xF6zabvKOQ7rHUDGT78a3xJMNlVuHc8qlih/gvUjklDCLkoHP+UCjsfjHM+MKLOfVvWDAXZuoR/JV15NaKqhAM6hC0Q7swIrp3AQuos5YKVuvmvMM5jY8GZbyGJvomfagwap4yjvhzSnF5zmifW797yTPRmpjc5fGSP8Q7v46cp/dN9fKKFqFqIGKvqDZGhdq2MUWQ6tK0lBjGNQMrbucrtAC3xe0igNAYeeaD5myFTmh4jej7O1GCRzABthjY9hodoqIXiqdJlc0mpbeiI2NlO3Ng+NJFJXuPM2OBlMV2ffk0vGmrwH+rgWBZ3A46Zxa0xRa9hI3HLTmCO+sQBbVdkdG9o446E8PDG6PJteHGHcLz8u75uDKR5JNJVRTG4LsWH0v8lioSUviw== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2017 22:41:41.1095 (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: CO1PR07MB205 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. 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 b5fb9c55..8b372b2 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -128,6 +128,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 */ @@ -403,6 +406,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) " @@ -410,9 +415,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 */