Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4297280pxb; Mon, 8 Feb 2021 12:46:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZ32vm2yhkPWCjNoZ015AV2h6bd1YMf+UYMFPjsirsGgFrd1NO88rcs7N8cDNUUzeYyRRR X-Received: by 2002:a17:906:2cd4:: with SMTP id r20mr18811081ejr.291.1612817202401; Mon, 08 Feb 2021 12:46:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612817202; cv=none; d=google.com; s=arc-20160816; b=0RGpSdQCTh+P5wDDSXmVOegcPxwN8iGh4mhG6BVebShhSuTFXkj9YDEpq6WCRUv0Rt 2+gUS+CTCxSqmAy5vciiDx+/+zJakQ1cPePYzlVr26R+BtuFb4mIsQaY/8U2WE4K4M/6 ZJWZYWXjxN9FSRKrrJlkYs65LgkmHJOgNC9d2PR2G1v5Eo9z7/5Ev/CQ/jj06Pl3y+p+ zcVTe5z1KAUb8jJC/+owjMO6JOfcxCDUXotn7gmze3ExMUFZ9K/JwyvvZLeGvOmo/ROB GIDlLa0oCOOEQa0hYEBmUeH4Vp2KrXfiY+M84arZ7BZ+QSvZexRrEMpCSPHB2hLKfDsX SdrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=ekryDzh7CqtuJpTiAyGom8aL8IUPv2qJB5wkgaK5lQQ=; b=o8G7hQS0Nn8AQjcQdTjfzqghDJVw5S+zJaNm9skXhyRY6TiaY2Ou/0bY/vIRKGw+/1 F4uLvwZXUJqRXVF06uPZAQl3NZcLOmEyZxAVWSuWDxjtrSC63s9oRXkFYPQuPus2g++X 7dGQ+FsA3EsveSPcegNAhh9PhRHOo9IZchUHg843Cl3Pk8NiYFyMdc+5YKfD235CG5Lp 89TD62K3BuevA0fjsBLeYUgRdMzjNHW4e2RWwBegBPfidwG4mlJPLP23aa4EKQcbNKY2 AAJRM1kUGO5IbDq7DBjSkDgdwGs4OODlYsRwHAdPakWxJA3CCV/1CaO8n8ckxis6dSCp vaVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WRWvJ91Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si11639202ejg.48.2021.02.08.12.46.18; Mon, 08 Feb 2021 12:46:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WRWvJ91Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234312AbhBHUp1 (ORCPT + 99 others); Mon, 8 Feb 2021 15:45:27 -0500 Received: from so15.mailgun.net ([198.61.254.15]:21748 "EHLO so15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236236AbhBHTe0 (ORCPT ); Mon, 8 Feb 2021 14:34:26 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1612812838; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=ekryDzh7CqtuJpTiAyGom8aL8IUPv2qJB5wkgaK5lQQ=; b=WRWvJ91Y9CqucaQrXFnkqIkdx2YUOMp8K6P/kWIVpAmlO/jpqGJ6tg6pxrfQ8lejWbn5oSOo XFzml4ZarFLUDCVFVyOcLP/dgZ/MfOQbaLLW8pjj1O6eKpl436oJ8vHAb8iqmj3Rd3IA6Y5h NfYurSjw6uAe4eUZLBBl5LaFC8M= X-Mailgun-Sending-Ip: 198.61.254.15 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-east-1.postgun.com with SMTP id 6021920a81f6c45dceca36e4 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 08 Feb 2021 19:33:30 GMT Sender: subbaram=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BA063C43461; Mon, 8 Feb 2021 19:33:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from subbaram-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: subbaram) by smtp.codeaurora.org (Postfix) with ESMTPSA id CCDCBC433CA; Mon, 8 Feb 2021 19:33:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CCDCBC433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=subbaram@codeaurora.org From: Subbaraman Narayanamurthy To: Stephen Boyd , linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, David Collins , Subbaraman Narayanamurthy , stable@vger.kernel.org Subject: [PATCH] spmi: spmi-pmic-arb: Fix hw_irq overflow Date: Mon, 8 Feb 2021 11:33:04 -0800 Message-Id: <1612812784-26369-1-git-send-email-subbaram@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, when handling the SPMI summary interrupt, the hw_irq number is calculated based on SID, Peripheral ID, IRQ index and APID. This is then passed to irq_find_mapping() to see if a mapping exists for this hw_irq and if available, invoke the interrupt handler. Since the IRQ index uses an "int" type, hw_irq which is of unsigned long data type can take a large value when SID has its MSB set to 1 and the type conversion happens. Because of this, irq_find_mapping() returns 0 as there is no mapping for this hw_irq. This ends up invoking cleanup_irq() as if the interrupt is spurious whereas it is actually a valid interrupt. Fix this by using the proper data type (u32) for id. Cc: stable@vger.kernel.org Signed-off-by: Subbaraman Narayanamurthy --- drivers/spmi/spmi-pmic-arb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index de844b4..bbbd311 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2015, 2017, 2021, The Linux Foundation. All rights reserved. */ #include #include @@ -505,8 +505,7 @@ static void cleanup_irq(struct spmi_pmic_arb *pmic_arb, u16 apid, int id) static void periph_interrupt(struct spmi_pmic_arb *pmic_arb, u16 apid) { unsigned int irq; - u32 status; - int id; + u32 status, id; u8 sid = (pmic_arb->apid_data[apid].ppid >> 8) & 0xF; u8 per = pmic_arb->apid_data[apid].ppid & 0xFF; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project