]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pinctrl: check the return value of pinmux_ops::get_function_name()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 2 Sep 2025 11:59:10 +0000 (13:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:41 +0000 (11:56 +0200)
commitba7f7c2b2b3261e7def67018c38c69b626e0e66e
tree6585b0233bf95cc397f7d651ca79fbd53352c240
parent933b87c4590b42500299f00ff55f555903056803
pinctrl: check the return value of pinmux_ops::get_function_name()

commit 4002ee98c022d671ecc1e4a84029e9ae7d8a5603 upstream.

While the API contract in docs doesn't specify it explicitly, the
generic implementation of the get_function_name() callback from struct
pinmux_ops - pinmux_generic_get_function_name() - can fail and return
NULL. This is already checked in pinmux_check_ops() so add a similar
check in pinmux_func_name_to_selector() instead of passing the returned
pointer right down to strcmp() where the NULL can get dereferenced. This
is normal operation when adding new pinfunctions.

Cc: stable@vger.kernel.org
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pinctrl/pinmux.c