Thread (19 messages) 19 messages, 6 authors, 2018-08-24

Re: [PATCH 9/9] power: supply: twl4030-charger: fix OF sibling-node lookup

From: Johan Hovold <johan@kernel.org>
Date: 2018-08-23 07:40:42
Also in: lkml, stable

On Wed, Aug 22, 2018 at 11:36:58PM +0200, Sebastian Reichel wrote:
Hi,

On Wed, Aug 22, 2018 at 12:55:47PM +0200, Johan Hovold wrote:
quoted
Use the new of_get_compatible_child() helper to lookup the usb sibling
node instead of using of_find_compatible_node(), which searches the
entire tree and thus can return an unrelated (non-sibling) node.

This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the parent device node).

While at it, also fix the related phy-node reference leak.

Fixes: f5e4edb8c888 ("power: twl4030_charger: find associated phy by more reliable means.")
Cc: stable <redacted>     # 4.2
Cc: NeilBrown <redacted>
Cc: Felipe Balbi <redacted>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Thanks for reviewing.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help