From patchwork Wed Dec 20 06:56:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125051 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 EAA586019C for ; Wed, 20 Dec 2017 06:57:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0F0629649 for ; Wed, 20 Dec 2017 06:57:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B9A2964F; Wed, 20 Dec 2017 06:57:05 +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 6EA3329649 for ; Wed, 20 Dec 2017 06:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932376AbdLTG5E (ORCPT ); Wed, 20 Dec 2017 01:57:04 -0500 Received: from mail-co1nam03on0062.outbound.protection.outlook.com ([104.47.40.62]:60343 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932295AbdLTG47 (ORCPT ); Wed, 20 Dec 2017 01:56:59 -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=7jm7Ew/snqlix8NEi4CurP6Pb+ucGPgc9dLP3jf4LuA=; b=hBL8lD3LPLqLVGwRTezEuw0ZCar7xLDsbXg7Vt4tj2KfJwVLpO1ezdv4UryGAjXrTSLNkhPI//qsfobX/lsxcpO5BIlwDj1Uk4Lv5166SM0bkLuSNP0puU4MshI5XQxS2a3GkR8aEIJOLYdmSAWIWd2HB6frOIQwgq+zXxMgnPg= Received: from SN4PR0701CA0005.namprd07.prod.outlook.com (2603:10b6:803:28::15) by DM5PR0701MB3815.namprd07.prod.outlook.com (2603:10b6:4:7f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:56:57 +0000 Received: from BN1AFFO11FD027.protection.gbl (2a01:111:f400:7c10::114) by SN4PR0701CA0005.outlook.office365.com (2603:10b6:803:28::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Wed, 20 Dec 2017 06:56:57 +0000 Authentication-Results: spf=permerror (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: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD027.mail.protection.outlook.com (10.58.52.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:56:44 +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, 19 Dec 2017 22:56:46 -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 vBK6ukEd021570; Tue, 19 Dec 2017 22:56:46 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6ukcs021569; Tue, 19 Dec 2017 22:56:46 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 06/43] qla2xxx: Fix stale mem access for IRQ name Date: Tue, 19 Dec 2017 22:56:07 -0800 Message-ID: <20171220065644.21511-7-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-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)(396003)(376002)(39380400002)(39860400002)(346002)(2980300002)(448002)(189003)(199004)(2950100002)(16586007)(8676002)(6666003)(81166006)(5660300001)(50466002)(575784001)(8936002)(50226002)(48376002)(86362001)(356003)(42186006)(72206003)(316002)(54906003)(110136005)(69596002)(81156014)(87636003)(80596001)(305945005)(85326001)(478600001)(106466001)(1076002)(59450400001)(47776003)(76176011)(36756003)(51416003)(2906002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3815; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD027; 1:Sgztqdus+LrdoN221Rw9TkEH1g5DUgqVCr2ZnZFbFO9xUmoaoQ9DC1DbmULGeGd57PO6SCB0m2ymChahjJJZiOA++u0wfoLwJ/62f6WfLSvms6PIKxQtCL8V0BTHUzS+ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c4ec9cb-2dc0-4e1c-45cf-08d54776d50d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307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uUB05LYiFPmWVihoobfVs=; 20:sxtfMBh+rwdYuZfvFOO3f+fO1NCPus8GjYUbryUAtORfG2H0rWncXZv8a7XqrvEcXk03kEtM4vGRYWgGWyqlMefBm6xkdYcG5nJ4gJ9UVVWyue3YYHS0Si7TRcu6IF5B2rP/v12jDsla9vNdbSRhK3T/JtaAC5VTBoXAiu6kKX3dtFFjs61D+2zAfmRwUdVDXg+4PC7HfdxudGAQ0SlhiYcm8NNMFTKlshLb6vaPSii2WIHhmmX9w2CUGGh7YrABtEvGkCexYi4a3v41rlM1PZzIrThf/I+55gOEyW9BQEyxXutF9tYSJQuKqBMgPeK7Ul4orj14nhAoHjjSfi01NKZ2kM2B0QxPHR3VM9yZ0H7Gn8a4NWTIGJRRh8wAg+3lC/91UTRzqY00Sxv0xxRcLh6wSIZBKI1d7QmeXH+sBGjLIWzJPM0+/DShXHXX85JfYbajLokFbS/Xylp0XIGmKFL8meWA2iY6kFRXy7tLUdhgv5L1W7cA9DtGujxesxjw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231023)(3002001)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR0701MB3815; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR0701MB3815; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3815; 4:z40S1PNsvssutBTSNTyG8pvL2X197jFGDXJH3ameOaS2oZJzM7qNhkU8SDxhWwYPHSfREribzH0O7/caMXShETA4muE0KY48QH/H0+p3x18DCmGIFlcymJ/uqui4A8ZyG3zebhbGNp5VSwlRVYVq3bLeADj7vEpPB7/iSBSmHskdhkWeF52LgnFW/IyBk/wosUe0vstA8Q+mRusVSMjkxo9wmtNRRdQY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EtAo9KRSn487Ib2GugEd5wY1suMB22ejn1kBvmf4ePpbgLb6kI+QWAkzDmsz9bm3Ya6UQvM/XVZN5miG9oNrVvQ86gxv5XV5hqj0l6vEpIs/Vy0DRzugM96pR95+NQDRF7RRkPFS9CtUbI5O35dYYICmJrEpgQADNOoVv4w/kRI0/pQg1moEjx/TOP7Rz9raal7TXtOGwrtmSTknAts/EZ9wY6nTwnPGJlVWA1LhiN0kOxYDWcD7O7rBSAZD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:56:44.5491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c4ec9cb-2dc0-4e1c-45cf-08d54776d50d 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: DM5PR0701MB3815 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 IRQ name pointer for INTx/MSI was pointing at stale stack frame. cat /proc/interrupts will trigger stale mem access. Fix it by creating dedicated space for IRQ name. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 4 +++- drivers/scsi/qla2xxx/qla_isr.c | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index ca3ef9360ab9..5e509763a419 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3140,12 +3140,13 @@ struct scsi_qla_host; #define QLA83XX_RSPQ_MSIX_ENTRY_NUMBER 1 /* refer to qla83xx_msix_entries */ +#define IRQNAME_SZ 32 struct qla_msix_entry { int have_irq; int in_use; uint32_t vector; uint16_t entry; - char name[30]; + char name[IRQNAME_SZ]; void *handle; int cpuid; }; @@ -4025,6 +4026,7 @@ struct qla_hw_data { uint16_t zio_timer; struct qla_msix_entry *msix_entries; + u8 irqname[IRQNAME_SZ]; /* msi/intx */ struct list_head vp_list; /* list of VP */ unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) / diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index a265c2d8c9cc..33865e0bb29f 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3607,9 +3607,17 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) if (!ha->flags.msi_enabled && IS_QLA82XX(ha)) return QLA_FUNCTION_FAILED; + memset(ha->irqname, 0, IRQNAME_SZ); + if (ha->flags.msi_enabled) + scnprintf(ha->irqname, IRQNAME_SZ, + "qla2xxx%lu_msi", vha->host_no); + else + scnprintf(ha->irqname, IRQNAME_SZ, + "qla2xxx%lu_intx", vha->host_no); ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler, ha->flags.msi_enabled ? 0 : IRQF_SHARED, - QLA2XXX_DRIVER_NAME, rsp); + ha->irqname, rsp); + if (ret) { ql_log(ql_log_warn, vha, 0x003a, "Failed to reserve interrupt %d already in use.\n",