From patchwork Tue Sep 11 17:18:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10596017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1650F14E5 for ; Tue, 11 Sep 2018 17:19:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDCC829B28 for ; Tue, 11 Sep 2018 17:19:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E237729B2F; Tue, 11 Sep 2018 17:19:35 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 640D129B28 for ; Tue, 11 Sep 2018 17:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728182AbeIKWTv (ORCPT ); Tue, 11 Sep 2018 18:19:51 -0400 Received: from mail-by2nam03on0045.outbound.protection.outlook.com ([104.47.42.45]:64849 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727751AbeIKWTu (ORCPT ); Tue, 11 Sep 2018 18:19:50 -0400 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:X-MS-Exchange-SenderADCheck; bh=NC80Nt6sIYvz0wfhvWqNDXcEzNLZRF8QFh70kqWqnkg=; b=Yg3JHptu4GwzF55xhqOw89ZjYyYhgZW3AZsRXMRSkOOSiTIl7CQUB/jwR0pSOfAnug0TH2AiCPe79UyXWvF52Tx3BdGxx7wSZdOBCYrXaRt8yf9sHivQdnCBkmLh4gLMlXuBw4MrbMqNPyDSGgqL3nw32u9AM5e46KRKRqT/gss= Received: from SN4PR0701CA0009.namprd07.prod.outlook.com (2603:10b6:803:28::19) by BN7PR07MB4387.namprd07.prod.outlook.com (2603:10b6:406:b6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.17; Tue, 11 Sep 2018 17:18:39 +0000 Received: from CO1NAM05FT054.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::200) by SN4PR0701CA0009.outlook.office365.com (2603:10b6:803:28::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1122.16 via Frontend Transport; Tue, 11 Sep 2018 17:18:38 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by CO1NAM05FT054.mail.protection.outlook.com (10.152.96.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1164.5 via Frontend Transport; Tue, 11 Sep 2018 17:18:38 +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.347.0; Tue, 11 Sep 2018 10:18:30 -0700 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 w8BHITkO029083; Tue, 11 Sep 2018 10:18:29 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w8BHITs7029082; Tue, 11 Sep 2018 10:18:29 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 08/16] qla2xxx: Fix early srb free on abort Date: Tue, 11 Sep 2018 10:18:19 -0700 Message-ID: <20180911171827.29016-9-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180911171827.29016-1-himanshu.madhani@cavium.com> References: <20180911171827.29016-1-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)(136003)(39860400002)(396003)(376002)(346002)(2980300002)(438002)(189003)(199004)(51416003)(8676002)(72206003)(8936002)(50226002)(81156014)(1076002)(81166006)(76176011)(36756003)(4326008)(87636003)(305945005)(106466001)(478600001)(48376002)(44832011)(50466002)(26005)(356003)(80596001)(476003)(186003)(42186006)(16586007)(106002)(126002)(47776003)(69596002)(110136005)(86362001)(336012)(54906003)(2906002)(446003)(11346002)(486006)(2616005)(6666003)(5660300001)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB4387;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT054;1:scmlhjkFKTkpGJ1TSA4GaS7ikJPX1ES1ghQBBPHreG0Mge6JTWfmkqHG7J/jvwXPRKmtQOmfk8ctWRSMWMaIYkTffvlA2JTvHfL7Co00e5MyBGDj53uK1+VjA/+gqh1d X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d2e6d1a-6b52-4847-5402-08d6180a9d57 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:BN7PR07MB4387; X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4387;3:WoUsaJ8PnaE6ou6tIar8874XHkRGzkPq5Dvx3GXxHepQVHL0SOckezSMpAv4ANxALniPAjBwoSQ1Nwf+mbpSwLLWmKfXWwqPfkf6BGkn7TkUxYlq5TM5/keU1lY79/IpqPU17Z4aXxkmsndWoFBynm6iDuqNzk14Ke0VUn0WsjSvrOXMD8jFqFXXzSrGWHHKU+htDVJyJf9/LmdiHSj7KToBkXD6daxBYvVmsefaBkpRoS1zWWs/2x2Ztm79bUI70WRwxJ7U+Q0cKyODGwkfUf3CUHY2ckcCJ0QvSKjkf4Evd1sXEB6iZPKiYGMSDuWsGYdMxFjgQ8FU9/Gc05Xz7QlE7fdxCckXV+5nqjaEpu4=;25:Hj7paNu/WSXzWTyvaL6cikjI5CX4WtyH95Kj8coI+P+t/OJX5hRxHJ3tXtyGSfi1h8XOT99gjK/E2l1t9qI7UBwJGKrfKA9s3SQxA9OY5Tj1jJv8anhXuykENvm2vPQIhGYp4izdEOxW507O7wIUQLuEqlYQpUROmi0QBJQyWw6UhgbLSG9g8pWopPhSylKJGkn7fgm4egs0Yld+qzum4rmgj93+K0Kxbl3DG63JKUa/M+IvXhDqMvcobZB8hsmyhQtCmV1PtYxIicLSNGaB9JYwjGvxbFcZAlVYOwKhj1VnvlkaXwpd/kzkkNXXMBjPIUTHIV2P4xpnkvvvVBPiYA== X-MS-TrafficTypeDiagnostic: BN7PR07MB4387: X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4387;31:Wd4SrZ3Py8z8odajLaorpRPHGdFr9EpPaVTBc75Nysbl8MWj1Ul4T9ZSb8jnOCAmb8GvIpg6Jd3IcZmX993PEXYrFdDczeoBgxp0IXnmTir4+9iWyb7AzQYZOKOji13EbrR5plnZLh0/oTR93DfFZJnnXnY0DbfWNo0lQMYkX9q7W1GdordpGZV0NkdUglPomwuj0CYbB/RcA49HEZBxwVkHiM0Oczaje8LzC/IXxF0=;20:TXgB6TwkwJZ5FUx6KfWsNjFuaqv8e6k7sTCGWUBIi1VE4AZNgZG3HfE4MARckvqmheelWVHEbhHtYfsbHf5tbo7Wey8jeWAOzYtr6X/BgBpfjJSxmly2KGMiuRp/9M7XNEYUxxVil+g9a65Qks5u6DFsJQJ1jtl9/p+BydToY6jDfNzMiyP5OFy3M5roqcaElpI0ZX/qPV08SSNuT7Gou7JlkQxY9N7sIPXQjOU+cxz4OtPJbsqqDNog7QkzUPtGNGKzo5+5n+ErP906pBKhMBZteNgPImnHh/mzaQcES5c9Jotg/0TRXJl8CsybJiDV+gnb5mrudsl0H+DX2w1rYnOGuXmPRlMOPR1ExWg/zM+7Kr64AnsLOoC8U9oythY8YWdRaZthAANJ/fxDqKciNoxq/S7crbRlmT+J13Xru0oX5VKofoVaaaFGt/fRTsd8Oizt/EutZGQBl0L7BmsRuUMLJCcZHiTnlKE1m6Ou6fROAYkR7OKEu0+X+OqqDujm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(10201501046)(93006095)(93004095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201708071742011)(7699050);SRVR:BN7PR07MB4387;BCL:0;PCL:0;RULEID:;SRVR:BN7PR07MB4387; X-Microsoft-Exchange-Diagnostics: 1;BN7PR07MB4387;4:FRcr1SyR7D2SmauMHHEuNNCFzA4+SSUfQ+bSvGKmho1ROcu5fuujJTGXNK7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RmEwRdtiTrlGV74Acl/x0hetoHtnXgfV3lTgLs0Mlv3Tk/oN4mUxtbhivT74XvOnayY5X+xwKkP1bgkxNO5v07KCkiBXLyZL4y0EjnxfTzgj4M7Vl/kHTwX4MJeiwRrxZPGxsQLSVMxY/espbSK7E9tnA2EqhnJgcHJneVN5YKq2h42GR3dg==;5:/8mSa1KljM9oTKThWdeWQ7ABld9b1Jz5wFo9FJrTqBwfQbpw+3vyDr2PsLslFYFWNiVs4fWeTMSAWhECsD/Ik8jFbA5KsWlol1Tyr8Julua1JGlmO8aXBfE60MVQTx3n9JH0B06PmnznnDium9VhCmjzIIhCGr7VDiKmfnbj4H8=;7:DVGDQEk9HvOUNmNCT14JOCbs+GdUsOgkV6OymMIqugIy98T7gQElChxYmrSipHawdCrDsREH87eExSNs7vY6yBrcgpo6objxQ3SJjv0ZrATzrWQPF7ohdlMsdFBv2Bsq/bMLi+L9Wa3zLZcqNenGnzpgtYwpajqc9cvj+8bseY8bzlQIampMErkVZ58XIoEj0oNEEz2DHRxfjfDv9YfRlll9TI4e3fYreU/Aqm2DyDZntiPRevUarzxlBVMMsUNK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 17:18:38.5489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d2e6d1a-6b52-4847-5402-08d6180a9d57 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: BN7PR07MB4387 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran Task abort can take 2 paths: 1) serial/synchronous abort where the calling thread will put to sleep, wait for completion and free cmd resource. 2) async abort where the cmd free will be free by the completion thread. For path 2, driver is freeing the SRB too early. Fixes: f6145e86d21f ("scsi: qla2xxx: Fix race between switch cmd completion and timeout") Cc: stable@vger.kernel.org # 4.19 Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 2e836d1427bb..0575210aa8f1 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1850,6 +1850,8 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait) wait_for_completion(&abt_iocb->u.abt.comp); rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ? QLA_SUCCESS : QLA_FUNCTION_FAILED; + } else { + goto done; } done_free_sp: