Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2220225pxb; Fri, 29 Jan 2021 17:18:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzqDpGosbRQ4XOKdgIxPtnwvy1kvI5vjw9Nw+OvtE2sCCNE7h7V90he28LAPKHN2sAXaa6 X-Received: by 2002:a17:906:384c:: with SMTP id w12mr7186564ejc.140.1611969483043; Fri, 29 Jan 2021 17:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611969483; cv=none; d=google.com; s=arc-20160816; b=XiD4LyEPn2i1MM1RknMIPnC6Ooc5kTlDbbmqW/T9BwsMZ74OKudeD6jxgIlScGmsTm mRRoqDlambqMdcDrbulelnapSlHoNmASHYRtZjd9y0Aej9FU5oZ4kq8KI/Wa803jGMBQ fMQb0b5Pk3q6qwxL6cr+EDC+ppk3EVyD1r31XNQpilyut9LE6XZQcJGZpNNCMCgWYixW lLluCzkruBlxSgUzHMMZG2yGa6MM8xXTqhEhL9iOTdW11bBaVegfbtGEO+AVqHr+TNfp 1OLu74Qc9fy/qV1Swxj1JKT7SIG418K6pUMEIFJtQ3vAMkFTSxwFtmqTb792I/GIDTs3 XorA== 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=Jir61713jtIz/+Grhk/VoUaGDczuLFkqmMveVw6KKAzhxzvXZ3i3JRhHvO7yGCMZM4 0BybLLZYP2HSLoq1FUKqV7Gfx+z8sPAjnh/hWpFFWLpea7x+YRGrQWBmLxqbhP7owGN/ QD3yYls07o3mZXNh8PH4jqyrBlWtBq+x4XhCeCyXsap83zb28j0aE2dqbfZVH4tQjjlm boy1tCAzlmXXCHR9+qlBoTfDwH1C8djSjyfcagF7d6wLUN3XyJGVbfoNwJmQIiftq+8z Q5FY5OG5wj5rkT4RPtwQyf4QQakrBlKSTX1NIKq8z/elCehReTVy1m3WG/QGM3RXNDFf z+oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DSrEyAQP; 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 l3si6502640ejd.83.2021.01.29.17.17.37; Fri, 29 Jan 2021 17:18:03 -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=DSrEyAQP; 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 S232323AbhA3BOs (ORCPT + 99 others); Fri, 29 Jan 2021 20:14:48 -0500 Received: from so15.mailgun.net ([198.61.254.15]:13940 "EHLO so15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbhA3BNI (ORCPT ); Fri, 29 Jan 2021 20:13:08 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1611969119; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=ekryDzh7CqtuJpTiAyGom8aL8IUPv2qJB5wkgaK5lQQ=; b=DSrEyAQPGfbw2L7igKQM4REugY41fwSpLBvT5woB7rmXBRxG0aUB3nqInmmctUGzjNmpRHg6 JhviDMr+VHZYl4ITeZ8biVsiyW9qX4BBkZlq6UQeXXtx3VioxAmE1WFnjVnwlrnD6B/V9FdW S+AHPW7rV598x9dTTW+96lD69eI= 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-n04.prod.us-west-2.postgun.com with SMTP id 6014af74f71e8b9934a90929 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 30 Jan 2021 00:59:32 GMT Sender: subbaram=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id DF450C433ED; Sat, 30 Jan 2021 00:59:31 +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 C6A93C433C6; Sat, 30 Jan 2021 00:59:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C6A93C433C6 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: [RESEND PATCH] spmi: spmi-pmic-arb: Fix hw_irq overflow Date: Fri, 29 Jan 2021 16:59:21 -0800 Message-Id: <1611968361-30552-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