[PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

Maxime Ripard maxime at cerno.tech
Thu Jan 21 11:40:13 EST 2021


Hi,

On Tue, Jan 19, 2021 at 02:29:08PM +0800, Liu Xiang wrote:
> When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return
> success. Even a group of pins call sunxi_pmx_request(), the refcount
> is only 1. This can cause a use-after-free warning in sunxi_pmx_free().
> To solve this problem, go to err path if regulator_get() return NULL
> or error.
> 
> Signed-off-by: Liu Xiang <liu.xiang at zlingsmart.com>

Is there any drawback to depending on CONFIG_REGULATOR?

Given that we need those regulators enabled anyway, I guess we could
just select or depends on it

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210121/86fec70e/attachment-0001.sig>


More information about the linux-arm-kernel mailing list