From patchwork Tue Jan 23 19:05:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10180965 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 E991B6037F for ; Tue, 23 Jan 2018 19:05:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB21227F91 for ; Tue, 23 Jan 2018 19:05:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDD582842B; Tue, 23 Jan 2018 19:05:31 +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 1CDCC27F91 for ; Tue, 23 Jan 2018 19:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751781AbeAWTFa (ORCPT ); Tue, 23 Jan 2018 14:05:30 -0500 Received: from mail-cys01nam02on0061.outbound.protection.outlook.com ([104.47.37.61]:47520 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751530AbeAWTF3 (ORCPT ); Tue, 23 Jan 2018 14:05:29 -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=aRcQN6jF8uQKBc/41T/zGfNN4rnULyKteL+IpmYMEsg=; b=IUmfm5eEGmTk3ausFbCLiUo79CEJWsbIm9Vzw2zEShL+gZR5gFcNsfwhMLi+o7JKz+csBxJiyCDVmIrL1iotZenrD0Lz7xv+ZBJtSh6CX9bQbbHVYxyJsbbu1+a8WljBfpDIwcH8oUKAG1i+KXyLS+ny2x3GmtlQMfz9R1MQ9L4= Received: from SN1PR0701CA0065.namprd07.prod.outlook.com (10.163.126.33) by BY2PR0701MB1942.namprd07.prod.outlook.com (10.163.155.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 19:05:27 +0000 Received: from BN1AFFO11FD045.protection.gbl (2a01:111:f400:7c10::194) by SN1PR0701CA0065.outlook.office365.com (2a01:111:e400:52fd::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Tue, 23 Jan 2018 19:05:26 +0000 Authentication-Results: spf=fail (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: Fail (protection.outlook.com: domain of cavium.com does not designate 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 BN1AFFO11FD045.mail.protection.outlook.com (10.58.53.60) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.428.12 via Frontend Transport; Tue, 23 Jan 2018 19:05:26 +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, 23 Jan 2018 11:05:21 -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 w0NJ5LlV011417; Tue, 23 Jan 2018 11:05:21 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w0NJ5LvA011416; Tue, 23 Jan 2018 11:05:21 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH] qla2xxx: Fix memory corruption during hba reset test Date: Tue, 23 Jan 2018 11:05:21 -0800 Message-ID: <20180123190521.11382-1-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 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)(396003)(376002)(346002)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(4326008)(47776003)(26005)(105606002)(2906002)(1076002)(106466001)(80596001)(69596002)(305945005)(356003)(72206003)(478600001)(336011)(87636003)(5660300001)(59450400001)(110136005)(54906003)(85426001)(86362001)(16586007)(50466002)(48376002)(316002)(42186006)(51416003)(81156014)(8676002)(81166006)(50226002)(8936002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1942; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Fail; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD045; 1:tx/xfdOWc3WTCOmvNvZojzK4H9k2/i7ZRAEl5lOeNccu0eYZDLuwVP60T63yDepATN6kAqInX3WD4iAs1Ejmo5uH1HHLA4/sL+J3LDVS4ZClAKfhCkO3zC2y1NAutd8R X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b4feb40-3f5f-4b80-7d9b-08d56294437e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR0701MB1942; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1942; 3:Q/9fMCJKLuw0ZnRGirXg55nWBPo/nGOXi1Y9UZaBBmZdt4Phs19KuV2z50wZPqanvqzo6Zirh3wgiccXxV1jsWFGepQZ1wAqIYgtBxe4e/4812OWkTBeUNVfv+QXREO63tx9C54i6GvrmslDbtXC4Xqgn9F+WyTW9JQm024Xx+8hoHc/+dn1gwd5MIY5XEeOSSY04c3HLrIs3zYqo5RRxCNzNDc8dR/BKD+8gKdZhb9zJM8IcJNBd2dM1XWYTMKIDElBISSE8Fg9JGwkWauH01km1s7LrSEqc4DGolP4sNGRCutnf+QyhHriM2103cClIFizz0srp7MPr9FwV70KLPka+8PdDZPhzaimN0RIc9A=; 25:iHowI6LAldPUVhEILkvKMZYj8yVbt7/fJmtM9vixmIYnYodNi1RUFvr4dHRSqI5cwSvjkaJR68DQQyU+ZGlyTxo3NYPFijnpa1WV1tDl2+NWdwf31GaWmfJOv7/HW+xYG1RV6hDWr/kJO5KyOJwQVdGYkEFE8DlTG3d8Mifd4HS3XIRqY0G71zhSMpThPW9e3CpqNHLLPUJ4efNy8qdFinR15usv7+PFneAQQZpIM07gG4fjPRIrRU+0/KkcUtoBnbyHfa3LYOi6jj6sGwZ5oRLd8jOA1GtzwdVQAPvcnWOLEQt2vsI1VzGOA/T+DVxqsHqOoR0EREiGaoJu6SiDoQ== X-MS-TrafficTypeDiagnostic: BY2PR0701MB1942: X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1942; 31:ACyzjzqVUAFUI7+73xHEPJ21cKY8StX67cqPjLBFmfTZkHgnmFgz15piqQHrZ3pz8JO0+g3HlULjcDNDXyAe/5ZrDZqOjdM+zj8NpIn7jk3d03nFuboBmXF1WJ0WZHKqi0nzgXVwC5iS08fbMvBEoM/nhiWErPNF/9Ag0Xd2c7u7tnLVU5YOaAqtUWzHvTRaIudUy8aKVoKRThx1aigj3/k5J1TaM6CYUroZm4XuNMc=; 20:LzQwGfdBxO1mAqhYIlAUGV8IqPnGpMPyeyX8WZZctG8I9MXr+XERiVPDCkev7psxMsPyJEDDinHCSAFVmf0CbIEhqZBZmn3NrVNEJ83TwBTRrem8g9c0RQNx1iGAjng5yGUsbSQTA7dYqg5K5hG368/PN3AuI9h6q1m/G+5Nd9HV/kjVDUkd+YIArrCO3+1lunToWTzI2VUm5vcoJchSaLH0Gok8cFi3xWIjnITn288WmmipmLpiCYsSGxYI1ldNEjqpX8PZ4DoCnf6gtsgKcCPpuctr0QPA1Nx6Gpo5OQ/5XJT0OsdME+Ng0phFG11duXTIpZfqXthn50m+Gb0ZJbCtgG/Zx+nxARXECnf4h1mk0zbF9UEaBUfnF6NKifzmBv3nh3u3qxW1LclMHVvSwp3OoAcnAPrc75tx8Qgmu3o0AkYnca8VJRCNBSvMBuvik3iHrlivJTSijvVmvIbp012LyKIZ0QoRkKHWsWQFwcAHJCkBpz8drt5FtmEpaVYX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231023)(2400081)(944501161)(6041288)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BY2PR0701MB1942; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0701MB1942; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1942; 4:O4KNsv40auxakHCPy6pSHTn6BykreXYT/WNonHk0jhGrMc3EK/164HLSE9PcIizS/Uel026IyNQUbk0Kj4bOhtrAU3hH6KYppHmfBFzgykMjFJQ4c5H158xLfCCY80H5Vi4jozLoU4ZaPU1NW55aCjxxSxM3ES4xU6MADH87SRWllRL+G7f2VEnWeas4ux/yh3bNcoIMTplfTlw70ktPQ7H6KDB92eB1v4+CAXFFnHTpkyt6OenqpwfzSSwcRJllKQf2C4BTiCHCLwFkkwKtYg== X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1942; 23:YNhL2XoIqsE1XZJi8hJPIKX0wxPFkFkaDGsSOi1?= =?us-ascii?Q?LxKqZVe4SrNoaeObrgRbgWtVlnKHPDvOZjwn8kcGHzhRrhXkf029+eyJdM63?= =?us-ascii?Q?mxQu/6AtSQ8lGOPeMirYK1w1zoZdF57Loom5GhXL/1d+4Yfj1ksx127UjPDD?= =?us-ascii?Q?JXB3C2IjPCXToeI/Ala0uIxc6uoB6gla3XXQQN3q2Bb6uhL8hEVlVI6OX/qU?= =?us-ascii?Q?ZLBkUim/Sq2HNTKdGyttWf5sbgg3PwxmPvxrzlgxOEaL5nKvUyZFFSNp6tDG?= =?us-ascii?Q?V6I+bPKeJi6cZJoMZ2Pu72/VoqEynYaeWVY2WyodPmhbUbb1kTAeVFIzPKwv?= =?us-ascii?Q?EnzIVJl1fsTRHI5i3s/J/tpKQ4FXYuHqYp7FXYnu9o1wZ7FzhEzXxTL09rZ+?= =?us-ascii?Q?cbElawqpYBeKl+s7wE6DfwAXjl3Udybc2P46NJZo0PrYzOaZVt2PxlPphcyb?= =?us-ascii?Q?4lRoHfSW6fgUt1I76ujHyu43NzhvX+lUUy9qViHnunlve7irnqt9f6q0qhBB?= =?us-ascii?Q?lkmALeG4icdyliDNx/iH61pTAwcgq9RmXO+KkloCcc+wAqH05RUA9SPYRPL+?= =?us-ascii?Q?kA0Nxzdxth2Yj1XB2ksqEAqsH44Fep7Fpp5lf6H/PgXGooBKsxh+KijvbLx9?= =?us-ascii?Q?6EHVt3rko/35ZuLfe9wLqRTKfWZna1QY2GTaMV0BQUSwWaDqWKii0HY+VoMS?= =?us-ascii?Q?N0NY8K2lDroXpKNo7KuD+Sq31rJgom23hifVcyo+9f3eN+hhPMQIMW4Wr2q8?= =?us-ascii?Q?7mOyHSV+CBkTfWZmE1reXvBoIv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zcyAAp6CFSmDLgc5IIMr5EqKeb/BoKCvvNKsQZuU8QqtbhsSOhnsU0IfpLSyp6Zvy4KM+5nq4Zq8lu/kdoKOE7NXi+J1L2K/hGa3YMica4A8c3VKR/qwnZDRu4veQW39FVy4EaVGOQU9awOIaA0G1BxaiKKxaQLK6GO2qJ7uwBkuunjGTFMlhFCXcP7SaI/Hm5ZNrZ+qF1HTe SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 19:05:26.6406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b4feb40-3f5f-4b80-7d9b-08d56294437e 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: BY2PR0701MB1942 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 This patch fixes memory corrpution while performing HBA Reset test. Following stack trace is seen [ 466.397219] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 [ 466.433669] IP: [] qlt_free_session_done+0x260/0x5f0 [qla2xxx] [ 466.467731] PGD 0 [ 466.476718] Oops: 0000 [#1] SMP Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Reviewed-by: Johannes Thumshirn --- Hi Martin, This patch fixes the crash for HBA reset test. From core dump analysis, memory corruption was discoverd during session cleanup. To prevent this memory corruption, driver needs to wait for session to be deleted and all memory associated with the session released before it can relogin and create new session. Please apply this patch to 4.16/scsi-queue at your earliest convenience. Thanks, Himanshu --- drivers/scsi/qla2xxx/qla_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 12ee6e02d146..afcb5567998a 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3625,6 +3625,8 @@ qla2x00_remove_one(struct pci_dev *pdev) } qla2x00_wait_for_hba_ready(base_vha); + qla2x00_wait_for_sess_deletion(base_vha); + /* * if UNLOAD flag is already set, then continue unload, * where it was set first.