From: Romain Gantois <romain.gantois@bootlin.com>
To: linux-kernel@vger.kernel.org, Pengpeng Hou <pengpeng@iscas.ac.cn>,
Felix Gu <ustc.gu@gmail.com>
Cc: pengpeng@iscas.ac.cn, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] misc: ti_fpc202: fix port ID bounds check
Date: Mon, 23 Mar 2026 09:25:00 +0100 [thread overview]
Message-ID: <4723113.LvFx2qVVIh@fw-rgant> (raw)
In-Reply-To: <20260322031923.57994-1-pengpeng@iscas.ac.cn>
[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]
Hello,
On Sunday, 22 March 2026 04:19:23 CET Pengpeng Hou wrote:
> The probe path accepts `port_id == FPC202_NUM_PORTS` even though the
> driver stores per-port state in `addr_caches[2][2]` and
> `probed_ports` is indexed by the same range. That lets a device-tree
> node with `reg = <2>` flow into `fpc202_write_dev_addr()` and
> `fpc202_detach_addr()`, where the driver indexes
> `addr_caches[port_id][dev_num]`.
>
> Change the probe check to reject port ID values at or above the number
> of supported ports.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>
> drivers/misc/ti_fpc202.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index 8eb2b5ac9850..578feefb77f1 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -366,7 +366,7 @@ static int fpc202_probe(struct i2c_client *client)
>
> goto unregister_chans;
>
> }
>
> - if (port_id > FPC202_NUM_PORTS) {
> + if (port_id >= FPC202_NUM_PORTS) {
There is an existing series by Felix Gu which fixes this issue among other
things:
https://lore.kernel.org/all/20260221-fp202-v1-0-4d28cb8b28fb@gmail.com/
I've reviewed it but I don't think it's made it into char-misc yet. Felix,
maybe you could resend your series?
Thanks,
--
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-03-23 8:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 3:19 Pengpeng Hou
2026-03-23 8:25 ` Romain Gantois [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=4723113.LvFx2qVVIh@fw-rgant \
--to=romain.gantois@bootlin.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
--cc=ustc.gu@gmail.com \
/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
all inboxes | Powered by JetHome®