Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wei Jie Law" <98lawweijie@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2 1/2] Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources
Date: Mon, 24 Aug 2026 12:42:18 +0000	[thread overview]
Message-ID: <20260824124218.BFEFF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824122733.76321-2-98lawweijie@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing error check for `irq_create_mapping()` return value.
--

--- Patch [1]: [PATCH v2 1/2] Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources ---
commit 8ffaede8e39380dc2ce433141763af42eefb7d4a
Author: Wei Jie Law <98lawweijie@gmail.com>

Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources

The commit fixes an out-of-bounds array access in the rmi4 driver by
increasing RMI_FN_MAX_IRQS from 6 to 7. A device can legitimately declare
up to 7 interrupt sources, causing the driver to overwrite memory when
indexing the irq array.

> diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
> index 90122df21f746..faf2ebb00d521 100644
> --- a/drivers/input/rmi4/rmi_bus.h
> +++ b/drivers/input/rmi4/rmi_bus.h
> @@ -12,10 +12,13 @@

[ ... ]

> -#define RMI_FN_MAX_IRQS	6
> +#define RMI_FN_MAX_IRQS	7

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential problem
in how the interrupts are mapped in rmi_create_function_irq().

drivers/input/rmi4/rmi_bus.c:rmi_create_function_irq() {
        ...
        fn->irq[i] = irq_create_mapping(drvdata->irqdomain,
                                        fn->irq_pos + i);

        irq_set_chip_data(fn->irq[i], fn);
        irq_set_chip_and_handler(fn->irq[i], &rmi_irq_chip,
                                 handle_simple_irq);
        ...
}

Does this code need to check if irq_create_mapping() returns 0?

If memory allocation fails or the IRQ domain is exhausted during device probe,
it seems we might pass 0 directly to irq_set_chip_data() and
irq_set_chip_and_handler().

On architectures where IRQ 0 is a valid and critical system interrupt, like
the x86 system timer, could overwriting the descriptor cause system
instability?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824122733.76321-1-98lawweijie@gmail.com?part=1

  reply	other threads:[~2026-08-24 12:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 12:27 [PATCH v2 0/2] Input: synaptics-rmi4 - fix two device-controlled out-of-bounds writes Wei Jie Law
2026-08-24 12:27 ` [PATCH v2 1/2] Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources Wei Jie Law
2026-08-24 12:42   ` sashiko-bot [this message]
2026-08-24 12:27 ` [PATCH v2 2/2] Input: synaptics-rmi4 - reject a PDT that grows between scans Wei Jie Law
2026-08-24 12:38   ` sashiko-bot

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=20260824124218.BFEFF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=98lawweijie@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox