From: sashiko-bot@kernel.org
To: "Wei Jie Law" <98lawweijie@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v4 1/2] Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources
Date: Tue, 25 Aug 2026 10:53:38 +0000 [thread overview]
Message-ID: <20260825105339.545ED1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260825103123.12216-2-98lawweijie@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Out-of-bounds slab write in F11 and F12 probe functions due to an unconditional assumption that the device declared at least 2 interrupts.
--
--- Patch [1]: [PATCH v4 1/2] Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources ---
commit 6aea384b7eaeeddd41195e537ea461a05594e8d1
Author: Wei Jie Law <98lawweijie@gmail.com>
Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources
This commit increases RMI_FN_MAX_IRQS from 6 to 7 to match the
RMI_PDT_INT_SOURCE_COUNT_MASK. This prevents an out-of-bounds array access
when a device declares 7 interrupt sources.
> 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 @@
> struct rmi_device;
>
> /*
> - * The interrupt source count in the function descriptor can represent up to
> - * 6 interrupt sources in the normal manner.
> + * The interrupt source count in the function descriptor is a three bit field
> + * (RMI_PDT_INT_SOURCE_COUNT_MASK), so a device can legitimately declare up to
> + * 7 interrupt sources for a single function. irq[] must be able to hold all
> + * of them: rmi_create_function_irq() and rmi_unregister_function() both walk
> + * it up to fn->num_of_irqs.
> */
> -#define RMI_FN_MAX_IRQS 6
> +#define RMI_FN_MAX_IRQS 7
[Severity: High]
This isn't a bug introduced by this patch, but can the unconditional setting
of fn->irq_pos + 1 in the F11 and F12 drivers lead to a slab out-of-bounds
write?
If a malicious or emulated device provides a Page Description Table where the
total sum of interrupt_source_count across all functions is an exact multiple
of BITS_PER_LONG (e.g., 64), and an F11 or F12 function is placed at the end
with only 1 interrupt declared:
In drivers/input/rmi4/rmi_f11.c:rmi_f11_initialize():
set_bit(fn->irq_pos + 1, f11->rel_mask);
In drivers/input/rmi4/rmi_f12.c:rmi_f12_probe():
set_bit(fn->irq_pos + 1, f12->irq_mask + irq_mask_size);
Since mask_size is calculated as BITS_TO_LONGS(64), it allocates exactly 1
unsigned long (8 bytes). With fn->irq_pos = 63, set_bit(64, mask) will
attempt to modify mask[1], writing 8 bytes past the end of the devm_kzalloc
buffer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825103123.12216-1-98lawweijie@gmail.com?part=1
next prev parent reply other threads:[~2026-08-25 10:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 10:31 [PATCH v4 0/2] Input: synaptics-rmi4 - fix two device-controlled out-of-bounds writes Wei Jie Law
2026-08-25 10:31 ` [PATCH v4 1/2] Input: synaptics-rmi4 - fix irq[] overrun with 7 interrupt sources Wei Jie Law
2026-08-25 10:53 ` sashiko-bot [this message]
2026-10-10 3:49 ` Dmitry Torokhov
2026-10-11 8:26 ` Wei Jie LAW
2026-08-25 10:31 ` [PATCH v4 2/2] Input: synaptics-rmi4 - reject a PDT that grows between scans Wei Jie Law
2026-08-25 10:47 ` 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=20260825105339.545ED1F00A3D@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 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.