Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2428175pxb; Fri, 17 Sep 2021 09:31:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDa42lLRYuYEqzWhsUe3Y6SBwL5yuSbpwAV/QYbXTGTfgR54svWuO62DXMEP6Ih1D3hSHN X-Received: by 2002:a17:906:2a8e:: with SMTP id l14mr12913535eje.321.1631896292856; Fri, 17 Sep 2021 09:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631896292; cv=none; d=google.com; s=arc-20160816; b=Y4Opo67kDV4qLTm6salw3R54oslyPomAG8eLfwHw+vGHeDGib1hsYYfIUvCClkSQoS uE/6R5vfFm9p0/nMl+mHBgewHrA7Y0B8/5NipIz23WRHP6YtDQdk90qkbInuC3Gvskf7 6WGGzJaKINH0IQImTVGC0LE6XhQqPKVg0dFC5l/+l0wjUKhbQCqMVeh0VAo6ZdXGBBI4 chAiTvsRNEaB88Qx+bn37hMDsqcqztWXVN0cTygSjII2c6L6L/ahueDQGWmjgkv1cl8V ZX8SolPiakdZtBvdV2DLgHOpyqmHyj07sCGH+8a6zesXctuIfeFybWB87VCwT455dXnO jUYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XwhljndGA6Jv2ltbwzx88Ni9Naz4wDVBE/5XzjZwT4c=; b=b/ISibAnrKulrOGSlbdfIjrG0+7IuP4HeS6cD3wyCZcHIp0ch1dvfCy4/XGo/fWvEV t+85NS1A5TLUjr7H8iZGY0BS31kXP28bgAPxLhpcbsBuSUZEdnv8zH5ILNWpOnYw56SE jOZMUzlUQ7JwdnASipP0PMw6/efZfm7QXpHmfcxF7qNwKttqX+B6xZ2NQWkegr7ohrrv +/Ankjezx3HY4kQ/w1t6tT2sd+Kc2/DvebahPilXP7mkScYXhTxSK02Ibsjr4H7XDbKm C6S4gWjnr5uoC4khD7YfHqhAjJ2mfbqxrt6aPy01YEiOSoil7EGnL6eMfVKG8tt34qUt eWAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=fg73tiag; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e4si6649629edc.234.2021.09.17.09.30.51; Fri, 17 Sep 2021 09:31:32 -0700 (PDT) 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=@quicinc.com header.s=qcdkim header.b=fg73tiag; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235555AbhIQGen (ORCPT + 99 others); Fri, 17 Sep 2021 02:34:43 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:60418 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235031AbhIQGel (ORCPT ); Fri, 17 Sep 2021 02:34:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1631860399; x=1663396399; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=XwhljndGA6Jv2ltbwzx88Ni9Naz4wDVBE/5XzjZwT4c=; b=fg73tiagLJ3HZIx7lNAgIPDZgr2n6NZ8vVh2u3FZSeGLreYApsFKvgMy IAna4YyzCdUyPSsN44MAMqU/eNN18BPAc9mo8T2DKX1xNoLGvpkacOl2X g35zOZgOTQ9YjEydyeCFGaWaLuSG3B2uPDPvX6gxqjAh+3jNkzNG+JaGW U=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 16 Sep 2021 23:33:19 -0700 X-QCInternal: smtphost Received: from nalasex01a.na.qualcomm.com ([10.47.209.196]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 23:33:19 -0700 Received: from fenglinw-gv.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Thu, 16 Sep 2021 23:33:17 -0700 From: Fenglin Wu To: , , CC: , , Subject: [RESEND PATCH v1 3/9] spmi: pmic-arb: check apid against limits before calling irq handler Date: Fri, 17 Sep 2021 14:32:58 +0800 Message-ID: <1631860384-26608-4-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1631860384-26608-1-git-send-email-quic_fenglinw@quicinc.com> References: <1631860384-26608-1-git-send-email-quic_fenglinw@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Collins Check that the apid for an SPMI interrupt falls between the min_apid and max_apid that can be handled by the APPS processor before invoking the per-apid interrupt handler: periph_interrupt(). This avoids an access violation in rare cases where the status bit is set for an interrupt that is not owned by the APPS processor. Signed-off-by: David Collins Signed-off-by: Fenglin Wu --- drivers/spmi/spmi-pmic-arb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 4d7ad004..c4adc06 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -535,6 +535,12 @@ static void pmic_arb_chained_irq(struct irq_desc *desc) id = ffs(status) - 1; status &= ~BIT(id); apid = id + i * 32; + if (apid < pmic_arb->min_apid + || apid > pmic_arb->max_apid) { + WARN_ONCE(true, "spurious spmi irq received for apid=%d\n", + apid); + continue; + } enable = readl_relaxed( ver_ops->acc_enable(pmic_arb, apid)); if (enable & SPMI_PIC_ACC_ENABLE_BIT) -- 2.7.4