Skip to content

Commit d2d73e6

Browse files
ProjectMutilationlinusw
authored andcommitted
pinctrl: single: fix potential NULL dereference
Added checking of pointer "function" in pcs_set_mux(). pinmux_generic_get_function() can return NULL and the pointer "function" was dereferenced without checking against NULL. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 571aec4 ("pinctrl: single: Use generic pinmux helpers for managing functions") Signed-off-by: Maxim Korotkov <[email protected]> Reviewed-by: Tony Lindgren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent c6e0679 commit d2d73e6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/pinctrl/pinctrl-single.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ static int pcs_set_mux(struct pinctrl_dev *pctldev, unsigned fselector,
372372
if (!pcs->fmask)
373373
return 0;
374374
function = pinmux_generic_get_function(pctldev, fselector);
375+
if (!function)
376+
return -EINVAL;
375377
func = function->data;
376378
if (!func)
377379
return -EINVAL;

0 commit comments

Comments
 (0)