From patchwork Mon Dec 4 22:45:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10091727 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 0DCFA600C5 for ; Mon, 4 Dec 2017 22:46:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3BAF29387 for ; Mon, 4 Dec 2017 22:46:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E864829446; Mon, 4 Dec 2017 22:46:18 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 58C9B29387 for ; Mon, 4 Dec 2017 22:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbdLDWqR (ORCPT ); Mon, 4 Dec 2017 17:46:17 -0500 Received: from mail-bl2nam02on0055.outbound.protection.outlook.com ([104.47.38.55]:15940 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752377AbdLDWqC (ORCPT ); Mon, 4 Dec 2017 17:46:02 -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=KE78niMGiVU1vlwfxE00nL1kUrlXnqR6/iyk/oqD8os=; b=b+FqA4O+hobWd6CiZrVElkmR5npxjCU1CgcC8hGrnWP1tjFhWsh06zm1wx18VlLpuEy29AE5cbePi9I7rR48nTv6QK21zYSdnVvdtoHUXzZjWlBxTySkPqpMJrn59Oaq8D15aP35qCJtXfsZbArpyMjPMOkt2UpcRjpzmT3SIA8= Received: from CY1PR07CA0027.namprd07.prod.outlook.com (10.166.202.37) by BY2PR0701MB1943.namprd07.prod.outlook.com (10.163.155.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Mon, 4 Dec 2017 22:46:01 +0000 Received: from BL2FFO11FD028.protection.gbl (2a01:111:f400:7c09::116) by CY1PR07CA0027.outlook.office365.com (2a01:111:e400:c60a::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Mon, 4 Dec 2017 22:46:00 +0000 Authentication-Results: spf=none (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=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 BL2FFO11FD028.mail.protection.outlook.com (10.173.161.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.239.4 via Frontend Transport; Mon, 4 Dec 2017 22:46:00 +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; Mon, 4 Dec 2017 14:45:22 -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 vB4MjMgd003525; Mon, 4 Dec 2017 14:45:22 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vB4MjMtA003524; Mon, 4 Dec 2017 14:45:22 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 20/22] qla2xxx: Fix system crash in qlt_plogi_ack_unref Date: Mon, 4 Dec 2017 14:45:15 -0800 Message-ID: <20171204224517.3409-21-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171204224517.3409-1-himanshu.madhani@cavium.com> References: <20171204224517.3409-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)(6009001)(376002)(346002)(2980300002)(428002)(199003)(189002)(36756003)(6666003)(87636003)(4326008)(316002)(105586002)(33646002)(106466001)(189998001)(54906003)(478600001)(42186006)(101416001)(1076002)(47776003)(16586007)(2906002)(110136005)(72206003)(5660300001)(69596002)(356003)(81166006)(80596001)(50226002)(8676002)(81156014)(51416003)(305945005)(2950100002)(48376002)(50466002)(86362001)(8936002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1943; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD028; 1:PPdQ197ZOR2/0nOC9Mfsb/bEMJDHLYFslniD3/6SpF3cW3arez78GoMXn0mb01JRyXafibrjopNcXgGlTo9etvmqGdldXKr6i3mY82zLjyaygx+bsTFDfSTKjXYGHWkE X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f05fe9e-3ed1-4eb7-3ad6-08d53b68caa6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603286); SRVR:BY2PR0701MB1943; X-Microsoft-Exchange-Di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q++nIVMfWRU57T4apz9fHXKaNljgVhgy6cWHLn0z3xdtnpLcoeE1bYplzMMuODzZ37TsNC8ffCpw3XadkHTCncA2fYtVnbhQRBNwzci8k1o2EM65mEyDP6H4lz5OI4yNRLNw+SzxS0vJ6E1N5slhf++q9bj/nP1dseb/0nrHoswiGAk37w/SkKnFlZuXVIxS16npgfSv9MGzm0ij1TyyqvkmQRqaoBBJVGMY0mP3DzWa1y24SrdjBQPXQss2T9n3RN+PrDZ1XbFk6lrvrYhVRhT9LFl9PKfJBxmcDRwUFRS49MMGTNiBFXHFGbirR8wwn1VpWk9E1okG7pUTaNoZlAo1DxkWlUoMSzNUt6n386j7JIOcc/ffS/ao3EJSsE/7r88xqbCaSFhuRyflCfkBydRkfppC0tGr0lWRVH6CO8jMZagEg5M8crawq/6swjjRJddhwrspVSS+E8+/naT+Za5XjGWOB/LCazV3GfgKy X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231022)(93006095)(93001095)(3002001)(6041248)(20161123560025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(6072148)(201708071742011); SRVR:BY2PR0701MB1943; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0701MB1943; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1943; 4:demYLfaBw/Y4McDax1P0UYOnXoiBMruo8xVw4m7FWZ6VOLGdGuQwRG71sq0BaVEL++wTOYu701XJtaCz+w7JL2I9LEA8iZoPCsyIN/233XOzMoSHTPC31GGXF6l37SB8Htnd1fLuQ67CTIydAHT5K87tl5zNK+JrqA6jjSoEzAP85hJT/FQfTZmnW/oXSiN1nnnGqZPoq6XUFA3v5AJcPS2+NuxQTg5fXDa2xNPTjwJap1JxMg5yAtiupyWHBnGcoFtvz6lX40RP6uGaHmv5rSRCBCv61/+FMvoFTllwTIcd19ew6NqHlWBmieXhh5FM X-Forefront-PRVS: 051158ECBB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1943; 23:i1ufzuSUUJ5AXjMZycL4+1cLlKbbzfA9EgCq2lG?= =?us-ascii?Q?SoTcm5A+f+4sXiMVXRemrEcuaoq+BJSv9P8e14/nqhoc8vzE9yQXxKHoLalF?= =?us-ascii?Q?yPHZ0b60Eiv0dx4vKeF3nmRl0IDXwQLKcl5ZPNkfKsBhVzh1ejb/qVcVWi7X?= =?us-ascii?Q?wEcXCtgRB4TNXjm0NyxdLo0/OrpHBj5oOck58PH7kods9mzOXD9KYO5CjiKo?= =?us-ascii?Q?GaXQbAxiN8D6lRiCR8ytOcaO0ILBes7P0hCT2bTj+Y8foxux+WbhsQXdHGBh?= =?us-ascii?Q?QzniO5p1y+1q7z4Qzd4jzO6Qm0kci+iIT2+8T2sl8tXF1WN3tXHElGk1bMlq?= =?us-ascii?Q?50u9j3CW7vy+IGXMS4oG9li/SuVRhG9kWUVmv8MVSr8aXLAnlt6zoQ7CCxlj?= =?us-ascii?Q?HSlie9JtQKFzDJiC/ikM4z5Dvs2p+pygagJQF22zoCVr16FRMC1yAadkjqPZ?= =?us-ascii?Q?KPb3eVqdc/qAzGMr8e7QPzQBuprOp/lerZAH3019K3ZJ0Ku7gt5S590X7zGY?= =?us-ascii?Q?gbPDC+pOXWTNuTe52X+oe5smfoxPRJhvS6rdOgjWdFcu79YJUbLDAvlSxasb?= =?us-ascii?Q?TmSAhl4D2ncrXi6+j7YPOIck6LNjD9o3Zndg/ks8Vdybsev5kwFaOr5vXbm9?= =?us-ascii?Q?2vx+ZxmAibTbSTneBIts03DG5/TvU8E3cB/bLKEQfwxFGTc0ErAa05tscaHD?= =?us-ascii?Q?gu8rp9DgEGho4vcRppj2Vmz/QgAh7fIKLInMVIU9+uD3vXbH7bloaILYGpQi?= =?us-ascii?Q?+L0qtaXszNNciGK8K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ky1HErZsZAHK2kvBVGQncwzYsTK+qIgvTdgq7PG13qd8szN6AOo3LbhU0Y5+byJj2OQ7SeJ1hlw/rgx0j2ECNRpoa3YTqRt08+ZhCqC1BwECOVFN/t+En8aA3bPUlUp93o4QscU6buqrZEQ3P3poOZxZE2Zh2M31Jx6o2yyBbvny0QpHYH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 22:46:00.1578 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f05fe9e-3ed1-4eb7-3ad6-08d53b68caa6 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: BY2PR0701MB1943 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 Fix system crash due to NULL pointer access. qlt_plogi_ack_t and fc_port structures were not properly bound before calling qlt_plogi_ack_unref(). RIP: 0010:qlt_plogi_ack_unref+0xa1/0x150 [qla2xxx] Call Trace: qla24xx_create_new_sess+0xb1/0x320 [qla2xxx] qla2x00_do_work+0x123/0x260 [qla2xxx] qla2x00_iocb_work_fn+0x30/0x40 [qla2xxx] process_one_work+0x1f3/0x530 worker_thread+0x4e/0x480 kthread+0x10c/0x140 Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") Cc: # 4.10+ Signed-off-by: Quinn Tran Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani Reviewed-by: Hannes Reinecke --- drivers/scsi/qla2xxx/qla_os.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 2ec77b9f78b8..789030c9dd26 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4750,11 +4750,11 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) } else { list_add_tail(&fcport->list, &vha->vp_fcports); - if (pla) { - qlt_plogi_ack_link(vha, pla, fcport, - QLT_PLOGI_LINK_SAME_WWN); - pla->ref_count--; - } + } + if (pla) { + qlt_plogi_ack_link(vha, pla, fcport, + QLT_PLOGI_LINK_SAME_WWN); + pla->ref_count--; } } spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);