]> git.baikalelectronics.ru Git - 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)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 8 Oct 2018 13:25:21 +0000 (15:25 +0200)
commit6f7ffb60aff4f9abe9d0512ec26996d1accd75ac
treed2d2fe620766a8caf5d26cdc934ef5b0ef14a3aa
parent535cb7bc929ae423a41d3c82003b84b17b421338
reset: Fix potential use-after-free in __of_reset_control_get()

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>
drivers/reset/core.c