pinctrl: single: fix potential NULL dereference
Subsystems (3)
PATCH 1/1 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.
--- drivers/pinctrl/pinctrl-single.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-single.c +2 -0
@@ -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 ;
Signature · 1 line
2.17.1
Quoted 3 lines · Maxim Korotkov
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.
Dear Linus,
Will this patch be applied or rejected?
best regards, Max
Quoted 6 lines · Tony Lindgren
Quoted 3 lines · Maxim Korotkov
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.Reviewed-by Tony Lindgren <[email protected]>
Quoted 8 lines · Maxim Korotkov
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 571aec4df5b7 ("pinctrl: single: Use generic pinmux helpers for managing functions")Signed-off-by Maxim Korotkov <[email protected]>
Patch applied for fixes.
Yours,
Linus Walleij