]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
reset: Fix potential use-after-free in __of_reset_control_get()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 8 Oct 2018 11:14:35 +0000 (13:14 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 28 Nov 2019 04:59:27 +0000 (23:59 -0500)
commitfb551ed09c434e71592aa8d68d93b43d0bd61350
tree0dbe48d47516ed0298d9ef090784c31d6f896478
parent816db2a2e4e54b0ec8d6f0dd243bfd44d61813b6
reset: Fix potential use-after-free in __of_reset_control_get()

BugLink: https://bugs.launchpad.net/bugs/1854216
[ Upstream commit b790c8ea5593d6dc3580adfad8e117eeb56af874 ]

Calling of_node_put() decreases the reference count of a device tree
object, and may free some data.

However, the of_phandle_args structure embedding it is passed to
reset_controller_dev.of_xlate() after that, so it may still be accessed.

Move the call to of_node_put() down to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[p.zabel@pengutronix.de: moved of_node_put after mutex_unlock]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/reset/core.c