Skip to content

Commit d2d73e6

Browse files
ProjectMutilationLinus Walleij
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 <korotkov.maxim.s@gmail.com> Reviewed-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20221118104332.943-1-korotkov.maxim.s@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c6e0679 commit d2d73e6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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)