From patchwork Thu Nov 30 03:40:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10084209 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 D9179602B9 for ; Thu, 30 Nov 2017 03:41:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D00F629935 for ; Thu, 30 Nov 2017 03:41:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C50CD29B02; Thu, 30 Nov 2017 03:41:37 +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 1FEE929935 for ; Thu, 30 Nov 2017 03:41:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753487AbdK3Dle (ORCPT ); Wed, 29 Nov 2017 22:41:34 -0500 Received: from mail-cys01nam02on0072.outbound.protection.outlook.com ([104.47.37.72]:20032 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753018AbdK3DlY (ORCPT ); Wed, 29 Nov 2017 22:41:24 -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=5suYLrCfrkhpyXZAw7eanr6XD+01LrczgeeVI2q9oGg=; b=nHO9AgJ+SYBn8NFUAqrtDe1TuYSguoATAh8ycfhd5V/DHHA678TUfNq+WqTST1I9fYIMCevcRzk2XdWAVNPky74BtzMnvLsM7MoGLFTWs47FWL0FZsbNJxeJm1cxMhnFgGjjhmdby9lzgzTb4wM7izUEK/CS+sj5owW+8yANMVU= Received: from CO2PR07CA0053.namprd07.prod.outlook.com (2603:10b6:100::21) by DM5PR0701MB3813.namprd07.prod.outlook.com (2603:10b6:4:7f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Thu, 30 Nov 2017 03:41:22 +0000 Received: from BL2FFO11FD052.protection.gbl (2a01:111:f400:7c09::116) by CO2PR07CA0053.outlook.office365.com (2603:10b6:100::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Thu, 30 Nov 2017 03:41:22 +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 BL2FFO11FD052.mail.protection.outlook.com (10.173.161.214) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.218.12 via Frontend Transport; Thu, 30 Nov 2017 03:41:21 +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, 29 Nov 2017 19:40:51 -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 vAU3epvW015186; Wed, 29 Nov 2017 19:40:51 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vAU3epCj015185; Wed, 29 Nov 2017 19:40:51 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 20/22] qla2xxx: Fix system crash in qlt_plogi_ack_unref Date: Wed, 29 Nov 2017 19:40:45 -0800 Message-ID: <20171130034047.15070-21-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171130034047.15070-1-himanshu.madhani@cavium.com> References: <20171130034047.15070-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)(346002)(376002)(2980300002)(428002)(199003)(189002)(42186006)(1076002)(16586007)(69596002)(8936002)(106466001)(189998001)(316002)(356003)(54906003)(110136005)(50226002)(50986010)(76176010)(47776003)(51416003)(80596001)(33646002)(87636003)(478600001)(101416001)(86362001)(50466002)(36756003)(72206003)(48376002)(2950100002)(2906002)(8676002)(4326008)(6666003)(305945005)(105586002)(81156014)(81166006)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3813; 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; BL2FFO11FD052; 1:z9mVLbPBMbLru4FjXCiivcDFL/g1+IW/pSB+1vFePtFH3w2mnBVgwn1JWr7SV8LsaK76sUkpOerb0Qf4BvWQ5FkIzv8soYaLj5V2L1LTKLQf4kxTsL+aIASUD+fAnPLZ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f44b0e68-b46b-4561-00e0-08d537a4397b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603280); SRVR:DM5PR0701MB3813; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3813; 3:bNUzBYC+/u4LMp/+x44AASV6p+OO2LKs02/PoNIcmTSdqGAFociFWzPdDA04l4uqNYIpf5a1NfEDBpco02jMeazVWL/F7xxSbQdTw8kV9kPOSdk04Jw+9hb4o0FLTGCDZepc0w3Jlj68k7bfNn1PuXn/fzXG84FSpI0T0D9b2333oStk6MMr/sb0R3gh1vlAgYbQE2TAHmdZtT333FoEfUlVn1OInYRZC05t44jI3g8VxOlp2F5lwyQ98kg6qho7f5xmibWoiqfXccaRw8Es0+hmeQ+RynansMe0JEuU7Ho+D5xt4neiygTWCLF/lVmCY6R+B/5zvTyka9Q2oqy2kQ3ZHScIBbqMcbbbeCJuCFo=; 25:X9o6RG2+7gywARbXmelPgjv91RfEPZgxxMK/X6swUNB3WKRtyrf80a4/pHcwotAt13QbuYDlYRQ08wBNPdxrtecDCI4YpqW10P9/zPs76XeGrjle/of5kpDQOpgGVEtFGkIKA/t7JOySNQhKMlvC82EnoFdZEOFdT8+lQg9pKv4qxKKl6r+FwdeD0e2uxe5S3eKqRy9WJYa/8VG7TnHOgOJoPWInP6HVtozMInKoKbiSktTOj6o9K8kPpVJgsawOxG4kCAUSOEF73Es0g3rv4GS1dSLHlRaprqtALlWGLfiIvTv+F97dB7eaUM/scFb+U7LOwfNyLXlEqO6A2AVTPg== X-MS-TrafficTypeDiagnostic: DM5PR0701MB3813: X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3813; 31:3aqQKy15OjPhr/ND90LvZMabSUUNu3BqcABUdZLXSTV0qnkFGsL+8hETOjr/rh5thViC5SF0BJpbibz5g9qVOeK9VPVjmVqsQx/z6eSy5Dy7Y63GZaj6wZc/URFhjkiDOx70hJFciySPIS3qrtIG1cnT81lHxUmQ5cL5jH0NGXYeX5gwbRULOtWIuqB92sRbgUntv/9nacst962SOvyspypoto466qS/mbMD0Gya0UU=; 20:b0O7c5ShLJf4TIOV4Or4E3GMBbtnuX3MLI5hdl+H/pR5313Hg3JmQvnDjmbqZYw9M7BSlo2oiySSvwBjPAYVrFbSxTHJK+MBtelCRIbZmp3I1Tmagta2qUIQtz2OojgXYw7669+C99kjetrxXkRkeUpM0Vt6istVDhmoRJZTtuI2Vuh5Dh7/4c5kI1Vjw/HQ7v0e42komqpDDpdPS/qjlx7izzvmCMAEWRzCaSrGdxBDbP7irQWZMfq1MhFwQOsLNPxUDXNPxSd4xU04eUB3x9uts3B4190jFlO6IiWvft+dL2S9iV1zvD+2iQneiTxXN6thM8MTwtQ4lZV5KGnZ8bF36Jm+tCeemae0p9SBYJkHK4+Of71qDiLJ5BZB1ql017cTb9sSjcC+0V5g77YS0rlE55vmifn2/peRE1qeitZq3yLlgNBbbx74cjS7J4leLIKqu8pgCWagk2jA9mLIQW0gqi6h6RvyT6JvNlk9nSsYwhO1ZGfe2YlLYSNE0sPz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123558100)(6072148)(201708071742011); SRVR:DM5PR0701MB3813; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR0701MB3813; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3813; 4:gUyXKRX1TYqxnJ24WF7p9aIqXb8yuXRsAxd9Z7spiQ4jM9A3/yK+fSGl29B6a/oJLiobKyAHXcgtDMWgtBS8zqHcxDGRnwzxI9WA5AZA5DuOzYsnN8Gd1ghRfO2XrMse7FXNANIwaQ6sRH9ljmaWgfYnetQ6555AG3Kb5mrboz2MIX5bM+Z/g7ga8qFK3qtADBW2FlgSIx1Ur1+MkJvU7U/Ull7jxGnzYUFr8A1sOlRsa4K4DYL/b6+kcirU5DTDU3ju7euSC2y3VvX1corNP/QLCEa0xcqTez47zkkazp62f5ATUOD5LwU7dpzOxekD X-Forefront-PRVS: 05079D8470 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR0701MB3813; 23:AljZvCLFhwlEQ6YUbDL4pF4CYylwJSWVy4f6FsZ?= =?us-ascii?Q?/VDaj+qx2tAzJbSXzTbYjhbhe5QDS3RRw65p0ywAybXN/V9XB3jJoWT1dTdS?= =?us-ascii?Q?oGkr9BzpetsgMrkY49yNpB2+NIkXCSfyFhHMT4JTbp4CiuE70KVWK3ywSCU8?= =?us-ascii?Q?UzXWcBF1NGAu0AQncuDYXeuuGl5D38iZOx6pf/1Lc+Zs/VHZjz9/CKQlyEsK?= =?us-ascii?Q?lJaM0gpfXG712CFL1ND5fFTcgie7rB7SvcnkNC/wcAiDQa9ZVpUw/zYPDCX2?= =?us-ascii?Q?ojFTaZkYzZgCBpTLPSWTlsfe91eRIvjFfQRXDAc8djaP2Bn8fwNS72dai5pV?= =?us-ascii?Q?LNJm6XnJCkX1NW+wZ7ftjM+fQ+D7PUNgAmYHfd4WJI7JxzzuBaZAkVVnFohk?= =?us-ascii?Q?LzlN5ov8IJrHtpES1L6QPIYMsYiJvoR0TVFb0GHba7aQfu3J/M+JtvQHfr+u?= =?us-ascii?Q?0Nzp1HMJzWgGDuCrKT9oBURVXJ3ppWVepqRzKICrbPs5hHnYxYXZZocMCJlH?= =?us-ascii?Q?hiLlfiM0XgGijxanqURb2dzKQy2EzMc2l5amtfHR0RHCxpgQPUzwv2nwiBek?= =?us-ascii?Q?b/fOHJH380pr2xyqEj+7ff/5L7s+F+YuvrpAKcmMZMGrFFljlatUYwKqFxDU?= =?us-ascii?Q?F4l8zlo+dWf/tfcTt+RKgktszy1mlFmB6vAlg65S81kH8mZfbiS90m8pjN7Q?= =?us-ascii?Q?HmLUk1Zzz3qo31c9Au2CZVlwTnRnh8XwMsGhemVbg5OCfvhd8koaBn1hRZbW?= =?us-ascii?Q?14tdsxRZgbDll48QRT13yGRtsXJZojog4fr440CMmikq1619PhLva00DVOD9?= =?us-ascii?Q?2BnMJodqZs/eoETCUcAHjTQLPZH1vY+lLGamk0w40SUxrMqOCV6fTZLDTlnn?= =?us-ascii?Q?LARoqSxiVekb1kyJslStggYXDZSCisVpdF5018rkbFmIEUUiqr7R+SKmpB0r?= =?us-ascii?Q?sD4hy01vDsXL37A8rXRQ2bqPGLQv/KKjaOWiRkCG3drCmtpkru9FRc7dO3qW?= =?us-ascii?Q?3ySGyMyDQEeG7Jwt1jwNp/PdQ?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3813; 6:lzFZIBjmj6QloH7ly+zBj9d5PgSlHU7fBuViAj3bfZYOobF8PC3hGGadQqBbqsXs8Ww86UCqgLBKOiZRFMmFbeW4F8qa2DyHWbIvVpb59WlD+ovvzZjeYW9zCskF24/l2w7s34KH/afAqsTRVHWGcN4e9YmTFriFrMT5fn/MwCzvnE85Tbgt19Sa2MQjS8kvrEJnSg80D9wIIW7o5dzy+IHklwPtH89df0L4lzlp+TV72uZOJ+QWpVT47285aSa9l7XVP5bC5daMRNwfHjIMGxyqYyCWcdTfYyVgUUPQecun/sDApNUNTPBrBnWtYdidRJB5AeFa5oeNFsDIgqu+ExhrX4j5rAfyWHHirdsU4y4=; 5:g7tSt7fFGIBfGvQ5gNjZsMn9IRilmiavfug/+N5ghVtgQJ75z0CihtjSbcqrcWmAg6aMcoH1cvMlLNuvOvXG5hRnbaXaEcG+NCiBWyfANJERoamLvJ3BEjXXYMXh9eK49E5m3jZWv2xmpHki7Dc1xM0rhHojGpufV39bjP3ZGTU=; 24:vUDnLfiUS5PIdNeJtxdaDvDw1cAfO+2TWvJ0y9MCyvmBUUghW7KlNIihH7bsALuMmBndQSTk45NCl6cqcqGLnTBnwirodBEUODYV58BcQ+U=; 7:qXmJ6oBlJY6qVHt656k3WJ0pQw/w2rF9iMcSk3G4NV/M4JRImbJbj8wENGo7wAkHM1Otngnq36Al117KAT0j4TALl71laczjwC+9IgibJmyEaMe9rb6BXm07dCnHS/hcA1OzmDl5W2/39sDyJx3spi8g/SP63FHhwDIdd/SfloQ3SoJ5TRsmFFqWjL67ff0tfubJNUe9+hgpq9f+XF53tfRXXcyX0nC2+zWfmnjKy3Lu2DuOLmtLcW/v9aro2Zfk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2017 03:41:21.7731 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f44b0e68-b46b-4561-00e0-08d537a4397b 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: DM5PR0701MB3813 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);