All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Cc: Daniel Palmer <daniel@thingy.jp>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Pengpeng Hou <pengpeng@iscas.ac.cn>
Subject: Re: [PATCH] irqchip/mst-intc: reject ranges beyond saved state capacity
Date: Thu, 20 Aug 2026 10:17:28 +0200	[thread overview]
Message-ID: <87qzjti4tj.ffs@fw13> (raw)
In-Reply-To: <20260722041443.10020-1-pengpeng@iscas.ac.cn>

On Wed, Jul 22 2026 at 12:14, Pengpeng Hou wrote:
> The inclusive Device Tree IRQ range determines nr_irqs. Suspend and
> resume then use nr_irqs to walk the fixed saved_status array, which has
> MST_INTC_MAX_IRQS entries. A descending range underflows the unsigned
> subtraction, while a range wider than 64 entries exceeds that array.

TBH, this is confusing at best. The problem is not the suspend/resume
implication. The problem is that there is no validation of start/end to
begin with. Whether that causes an out of bounds access somewhere down
the road is immaterial. 

> Reject both forms before deriving nr_irqs.

Both forms of what?

Something like this:

  The interrupt range for the driver is retrieved from the device tree,
  but lacks any form of validation.

  As a consequence a malformed device tree can result in out of bound
  accesses when the range exceeds MST_INTC_MAX_IRQS.

  Add the missing sanity checks.

> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>

Lacks a "Fixes:" tag.

> ---
>  drivers/irqchip/irq-mst-intc.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/irqchip/irq-mst-intc.c b/drivers/irqchip/irq-mst-intc.c
> index b5335f6fd6d6..1475335d668d 100644
> --- a/drivers/irqchip/irq-mst-intc.c
> +++ b/drivers/irqchip/irq-mst-intc.c
> @@ -263,6 +263,10 @@ static int __init mst_intc_of_init(struct device_node *dn,
>  	    of_property_read_u32_index(dn, "mstar,irqs-map-range", 1, &irq_end))
>  		return -EINVAL;
>  
> +	if (irq_end < irq_start ||
> +	    irq_end - irq_start >= MST_INTC_MAX_IRQS)

No line break required.

> +		return -EINVAL;
> +
>  	cd = kzalloc_obj(*cd);
>  	if (!cd)
>  		return -ENOMEM;


      parent reply	other threads:[~2026-08-20  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  4:14 [PATCH] irqchip/mst-intc: reject ranges beyond saved state capacity Pengpeng Hou
2026-07-25 15:36 ` Radu Rendec
2026-08-20  8:17 ` Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87qzjti4tj.ffs@fw13 \
    --to=tglx@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel@thingy.jp \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mark-pk.tsai@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=pengpeng@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.