mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 18:35:20 +02:00
pinctrl: single: fix potential NULL dereference in pcs_get_function()
commit1c38a62f15
upstream. pinmux_generic_get_function() can return NULL and the pointer 'function' was dereferenced without checking against NULL. Add checking of pointer 'function' in pcs_get_function(). Found by code review. Cc: stable@vger.kernel.org Fixes:571aec4df5
("pinctrl: single: Use generic pinmux helpers for managing functions") Signed-off-by: Ma Ke <make24@iscas.ac.cn> Link: https://lore.kernel.org/20240808041355.2766009-1-make24@iscas.ac.cn Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d80bdfaa48
commit
4ed45fe99e
|
@ -349,6 +349,8 @@ static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
fselector = setting->func;
|
fselector = setting->func;
|
||||||
function = pinmux_generic_get_function(pctldev, fselector);
|
function = pinmux_generic_get_function(pctldev, fselector);
|
||||||
|
if (!function)
|
||||||
|
return -EINVAL;
|
||||||
*func = function->data;
|
*func = function->data;
|
||||||
if (!(*func)) {
|
if (!(*func)) {
|
||||||
dev_err(pcs->dev, "%s could not find function%i\n",
|
dev_err(pcs->dev, "%s could not find function%i\n",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user