From patchwork Thu May 25 01:06:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9747465 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 861EA60224 for ; Thu, 25 May 2017 01:06:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7819A26C9B for ; Thu, 25 May 2017 01:06:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D09926E97; Thu, 25 May 2017 01:06:38 +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 1372A26C9B for ; Thu, 25 May 2017 01:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162240AbdEYBGh (ORCPT ); Wed, 24 May 2017 21:06:37 -0400 Received: from mail-sn1nam01on0070.outbound.protection.outlook.com ([104.47.32.70]:54770 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1162190AbdEYBGe (ORCPT ); Wed, 24 May 2017 21:06:34 -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; bh=63Nc5pK1TzT50Lm/EQmZewyt1rOFyC8uEy3EORBUD7k=; b=KDkPNp9XrOq8H5GylTLidD+WkKIbpTN2YFYk0c+eeeHZrdbT+AyIipqi2BstOYZdt9/HGWxUEMwYe0bJKfMIFc13EyeVY53aqOOMoMC0XHdU0fyNR83MT1zrMAYtBRQV8C8pphT3w0ZtpSmSFpbVTGABcQA+CswHGEkGDakf700= Received: from DM5PR07CA0047.namprd07.prod.outlook.com (10.168.109.33) by BN1PR07MB423.namprd07.prod.outlook.com (10.141.59.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Thu, 25 May 2017 01:06:31 +0000 Received: from BL2FFO11FD026.protection.gbl (2a01:111:f400:7c09::148) by DM5PR07CA0047.outlook.office365.com (2603:10b6:3:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Thu, 25 May 2017 01:06:31 +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 BL2FFO11FD026.mail.protection.outlook.com (10.173.161.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1075.5 via Frontend Transport; Thu, 25 May 2017 01:06:31 +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; Wed, 24 May 2017 18:06:24 -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 v4P16OCR008929; Wed, 24 May 2017 18:06:24 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v4P16Occ008928; Wed, 24 May 2017 18:06:24 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 2/7] qla2xxx: Fix NULL pointer access due to redundant fc_host_port_name call Date: Wed, 24 May 2017 18:06:19 -0700 Message-ID: <20170525010624.8886-3-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170525010624.8886-1-himanshu.madhani@cavium.com> References: <20170525010624.8886-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)(39840400002)(39400400002)(39850400002)(39410400002)(39450400003)(2980300002)(428002)(199003)(189002)(9170700003)(48376002)(189998001)(50466002)(42186005)(54906002)(33646002)(8676002)(81166006)(38730400002)(2906002)(356003)(2950100002)(106466001)(6666003)(105586002)(50226002)(8936002)(50986999)(76176999)(72206003)(5003940100001)(5660300001)(305945005)(101416001)(47776003)(87636003)(4326008)(86362001)(80596001)(478600001)(36756003)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR07MB423; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD026; 1:NWi8vhtZVbU35KZ/gYdMT9VW2Kglyh02uDejyRvVDZhhcOnfnuKAyvK247HpTKK0zupQH3Ssgn8BzjX7qhNmp6vGPDbQW9inzYnv2szd5r/euprsJTvawOgBEVJRwZfOTDV+Zgc2I1VFbcX49P3Wcf7CRxQCqGpcnJ4Ado9GTZZex7EhGgQKJ6JtfHsQlhwxlJzM5oJdFCCdVpYWyK8Zo4cFtuOX3HQnY43/QGuBswxMKxAnxs19VKdCRoY9+YaxkpVwHgp2g3ONaMH3M3kZffE7Q5vUDId+2lcwRL8agQ5636fMTSWc/dNpQwwg9aZK8YW1aok4VvS2zL1YajMVsbMmUE5ZFST+A3we7YCzqaY/MgGqwtHmjoVMOLiYtn+DTTfTHlpuJFJm2QGC3XbYyXycsbQ6faxITqdW4HzVUZUAydL6jKqFKLKSeJ0Oc5VlVUHBTWDtGgTcUNLdiw2bdmQeTAUccGnQ6MiVpIE1V/1sbOoA5NJsqy2H+wvPO8nf X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PR07MB423: X-MS-Office365-Filtering-Correlation-Id: 3aff6546-8b60-4af8-1476-08d4a30a47c4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BN1PR07MB423; X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB423; 3:uDC4jYp5IQ6JfVM248BeCz1e54802nyf2Ep6j8u9tmCB80n4dQCkW7KmaSfHuuAni/yWJXyhV2asrlKnU6uv8P1xPE6C8W6XNV8USiY1S99yB3etiuNFrQhJoG2RvvHbXJrRk9PfDxGwzGUzVm08sXKgpH/wf7fkLXvXZmlTmEdGIdcxkvyhMV+CZHUd0VcZEP4raef/mDQFkn9BPwgS7l0DlJUzYw6aDuuANHY9M79PXwgNlTmkLJWNCOFE1cAZTvbjHiHgMHyHkp4aEsnx/7Xapq8IV7ITcFdE9k4GsKWhkXFMj9qw2H0imf8g/my+5FACVnRBAmnAmO+jiOIT4VBywumjWnQhKsavSkaXAYszGkhMI04CX76OJcyx7Jx3c2S337cLfLI6PmVYDIAeLKUIn3L91FzWjMOIK3w5alwXQuOI6OYhJ8TMEGztlR84sqOn9yFvEOpEFHHloXuchx6+gYfnblPCtdsZuEwUxNqz/SAn6VXeNH+aatmK19jY X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB423; 25:QNo103UoNziCFsPkmrJzyFZr9dI8YkBTCL23QMI/c/R7fYsQJvgETb+b0HM7/8QXDhpgtuwG2YzXub3cb314GPkBZC8w+5yF7nJSh7qLanIS8d1Zz/x+Cc6GDZPL12RGCJcVT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1dHzMX+a/00HDmeqpdc71WwJOFk7k3iymeqV6WY2ZUJO3ByaRlG7CS7EDxPdTc9A+1I0PsDIJdp7frWlTu14a63gj5jSuos/FCDjCx6TCs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(13016025)(8121501046)(13018025)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:BN1PR07MB423; BCL:0; PCL:0; RULEID:; SRVR:BN1PR07MB423; X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB423; 4:62xwwJuZn76XuINjR8SNXiVRDsTF3DR0bs1Q7c5Kp8U0V+febhp6pJkgSKK/1YRJ/2w2+EsgzCilENhKMJkfe73Lij7sUScvqbbl43HsngKX/788LLtTFPZYaJjUGFR8K4GYROSXpIPCkAHyC9jTFdjRuFPQZH8Xb+R5vtK4+HqbrDtDkbR4ieoUBm7BvGIlf/DjTrtQu55fNEGOccIFwUbkl2tgyCl3Vi3KPDgCMRns+aH6T1SVCa1dizMzaszWQ4TFWeQLfrkkxi1qq9aUxeuMsqQFzaTq9psHFOK+2rl2f+CQFcU6DOXwRpgHDijFedebubtR3EgO7DUH0/TyOYRxZSOVC4D0C6lUgGn+O7P5/uXCVbWUd8tBqY3DUurN0607wYQlYVp90gbNFPhXJrVxy7dKgwJpUPFqr/OZZbtaj4k+4JUWtn/fJmuNUx4wFi/MEbl2w2b+JW6vOzxPthimKurlI7EJh4y7nXGlvoR2S8xogF/WUrKLM9Ebiqcn6NeU0OXl5OWo4bevLOw4Uthub7fM+lYdYsAPEO1g57jYHCY9amM0A/2Re3RW1Yuw+2G68Fepso8LDiPxdLUGzPVsPWUqGhGjnsjwic6MImM8y+GfwnybzdiLtphIiURDBNzOelZ+NAefKn7TIkfE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Jgtwqw3?= =?us-ascii?Q?9s89if5bFoIKfN4Z+axBDFUXFNTmgr3DzE06iAdorXEJ97Kf7yunSaXA/5yG?= =?us-ascii?Q?KRU2DZ6BGcHxkjph1OOOWXzrOid/ywgNeNaGXG6XcRZ0wpdcvTBZRXnmSg65?= =?us-ascii?Q?b25Zu+kIN+ju/M2QAiWYMASfSZ4UIkF224lIyGQhDxRT48ctUPzZPC/T56jb?= =?us-ascii?Q?REY+sd6SHAd+m3Tb31RhBwSzNR5GyXKQ+drZKgav9emJW9dJYZPTzrtEZikw?= =?us-ascii?Q?dVD7sc8AZLC2F10KcFws7OHSM3poCQU0EupjbImqdcZhzj73PvoA8joh//QB?= =?us-ascii?Q?a/VQNf5HsRqQUwfRyYIynm0GzneLbxm5Eh+aRQ1SioEEyw4M3OKxef07jy//?= =?us-ascii?Q?yFmjQxxhbBzb1pMPAvU2CZYUo0/c37LsKUKTZonExzDkV/w2N8oTE1SoqnO2?= =?us-ascii?Q?OCXGL2sJhMHtS1cOCvIfDuALLf?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB423; 6:JY/uqCm86thD9iJTYpkCryziHVqwYMdTNeyEin1Iw56ge73NOPfU4DBdBerwtNPOBGadsYxgciB4RYtMoGaUM9wk4gUxvqDKBHivOtEt6af1HYoeQiYw2hqvFqVmhYPrczVAfxC5lSUzSPkhZZo9dQUi69KDKCtLbDOrsYD1vSFdnE436jgvgqLY0xdpJObdiFKagrKTWQ7Bpn2eymuKdC/BmU8Yq4lCRy+rgNUiMOiRaYiEdcNx3KThc8gvwgfaJ0NAvqgHu6DOxd2AbIujUTbi6eWy7w3jAhdIohBgXWID10/DbK+CROEttizoZ6rART0l+E2JWH68Fg/DoSGjTT6tStbX4854DE5k92uL/W/29EB7VYCHCGHdWptXT7KhkMenSUBsvCljCOjtnJlRA5lmnyqEMjslmiIE+G7vOacejYGL2OA1ads1hIBO8H3hVTLePDkmEOKs9pq9SqRWmZ9aDPfevGgwIAacn7sQv6uL/yQX7Q2EaRWKgDKNbL8lpZ+WignRZ4vz9e24e8TpMg==; 5:c1axKpuE6Fq6fbVuuiR2DaJ+Mt5wbAJfQx/JfHv304ZqTWQxT7fjsKXSF/WrEQYllX0njFF59hEozIhUGC6uGJJznNhobxnkJwOus2/GyIosMTvpFYBf96wGPuJhMEL71S2WSIkHCZvbaKvCH6rIsQ==; 24:6NgzNgavJ9bmPjvj75deJJMBe93UrRT1g+nzvuwCTWiwSoQXtXpnOhT03e+uJuKfbMm6jOZtRWfmLEI/6M2oUPUFOZp4NbdWrLeWjUomyAg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB423; 7:e02O/DWST7H1V7w1rDOtP4MHArJhEhXsxR3SN2MAzPi1oFmHJFtXad1aSyBp03/hbJhxXEy9fQDDwEmzkoRpcPGm67gu0HAkpVPJbmM7IaI/CS74VDUsQmbTMz+x3rp3xkdc7KFxuydxjgO5n+izeIUQCb/htO+p+J7igQL8EF/TrI3dsW+VMYm8LKMz9mj0u4AjpWRmc792AtQHY95ELJ1rdJxtvhE3xu9DYpz7NnyyFn74M2jbVaMSFLeTtZ8nBFSoxpvdZtWHvbRK4oxX/I3JD9LjwtQf7ui/SMJPKZ3VO2d6O9UKlRDoNtPI7BOJrZWvr3XHrDpWdybaLffNLg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2017 01:06:31.1683 (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: BN1PR07MB423 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 Remove redundant fc_host_port_name calls to prevent early access of scsi_host->shost_data buffer. This prevent null pointer access. Following stack trace is seen BUG: unable to handle kernel NULL pointer dereference at 00000000000008 IP: qla24xx_report_id_acquisition+0x22d/0x3a0 [qla2xxx] Cc: # 4.11 Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mbx.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index a113ab3592a7..12fea77e31c6 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3676,15 +3676,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, qlt_update_host_map(vha, id); } - fc_host_port_name(vha->host) = - wwn_to_u64(vha->port_name); - - if (qla_ini_mode_enabled(vha)) - ql_dbg(ql_dbg_mbx, vha, 0x1018, - "FA-WWN portname %016llx (%x)\n", - fc_host_port_name(vha->host), - rptid_entry->vp_status); - set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags); set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags); } else {