Commit e9c11657 authored by Dan Carpenter's avatar Dan Carpenter Committed by Yang Yingliang
Browse files

pinctrl: core: delete incorrect free in pinctrl_enable()

mainline inclusion
from mainline-v6.9-rc7
commit 5038a66dad0199de60e5671603ea6623eb9e5c79
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9TM8C
CVE: CVE-2024-36940

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5038a66dad0199de60e5671603ea6623eb9e5c79



--------------------------------

The "pctldev" struct is allocated in devm_pinctrl_register_and_init().
It's a devm_ managed pointer that is freed by devm_pinctrl_dev_release(),
so freeing it in pinctrl_enable() will lead to a double free.

The devm_pinctrl_dev_release() function frees the pindescs and destroys
the mutex as well.

Fixes: 61187142 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Message-ID: <578fbe56-44e9-487c-ae95-29b695650f7c@moroto.mountain>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Conflicts:
	drivers/pinctrl/core.c
[yyl: adjust context]
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent d2901c3f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment