* [PATCH] misc: ti_fpc202: fix port ID bounds check
@ 2026-03-22 3:19 Pengpeng Hou
2026-03-23 8:25 ` Romain Gantois
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-03-22 3:19 UTC (permalink / raw)
To: linux-kernel; +Cc: pengpeng, Romain Gantois, Arnd Bergmann, Greg Kroah-Hartman
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) {
dev_err(dev, "port ID %d is out of range!\n", port_id);
ret = -EINVAL;
goto unregister_chans;
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] misc: ti_fpc202: fix port ID bounds check
2026-03-22 3:19 [PATCH] misc: ti_fpc202: fix port ID bounds check Pengpeng Hou
@ 2026-03-23 8:25 ` Romain Gantois
0 siblings, 0 replies; 2+ messages in thread
From: Romain Gantois @ 2026-03-23 8:25 UTC (permalink / raw)
To: linux-kernel, Pengpeng Hou, Felix Gu
Cc: pengpeng, Arnd Bergmann, Greg Kroah-Hartman
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-23 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-22 3:19 [PATCH] misc: ti_fpc202: fix port ID bounds check Pengpeng Hou
2026-03-23 8:25 ` Romain Gantois
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®