Re: [PATCH v2 09/12] pinctrl: single: Reject invalid register width in pcs_probe()

From: Sverdlin, Alexander

Date: Thu Nov 19 2026 - 17:38:28 EST


Hi Lee!

On Thu, 2026-11-19 at 20:49 +0000, Lee Jones wrote:
> If the "pinctrl-single,register-width" property specifies an unsupported
> width (anything other than 8, 16, or 32), pcs_probe() hits the default
> branch in the switch statement and continues without initialising
> pcs->read or pcs->write, leading to a divide-by-zero in
> pcs_allocate_pin_table() or a NULL function pointer dereference when
> accessing registers.
>
> Validate pcs->width immediately after reading the property and return
> -EINVAL from the default branch in pcs_probe().
>
> Fixes: 8b8b091bf07f ("pinctrl: Add one-register-per-pin type device tree based pinctrl driver")
> Closes: https://sashiko.dev/#/bug/linux-a0303b6e-d0c6-4292-aeeb-fa8a21861827
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>

> ---
>
> v1 => v2: No changes
>
>  drivers/pinctrl/pinctrl-single.c | 34 ++++++++++++++++----------------
>  1 file changed, 17 insertions(+), 17 deletions(-)

--
Alexander Sverdlin
Siemens AG
www.siemens.com