You need to sign in or sign up before continuing.
提交 d2d73e6d 编写于 作者: M Maxim Korotkov 提交者: Linus Walleij

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: 571aec4d ("pinctrl: single: Use generic pinmux helpers for managing functions")
Signed-off-by: NMaxim Korotkov <korotkov.maxim.s@gmail.com>
Reviewed-by: NTony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20221118104332.943-1-korotkov.maxim.s@gmail.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 c6e0679b
......@@ -372,6 +372,8 @@ static int pcs_set_mux(struct pinctrl_dev *pctldev, unsigned fselector,
if (!pcs->fmask)
return 0;
function = pinmux_generic_get_function(pctldev, fselector);
if (!function)
return -EINVAL;
func = function->data;
if (!func)
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册