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

Sverdlin, Alexander alexander.sverdlin at siemens.com
Thu Nov 19 14:38:02 PST 2026


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 at vger.kernel.org
> Signed-off-by: Lee Jones <lee at kernel.org>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin at siemens.com>

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

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com


More information about the linux-arm-kernel mailing list