]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: typec: wusb3801: fix fwnode refcount leak in wusb3801_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 3 Dec 2022 07:10:27 +0000 (15:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:26:28 +0000 (13:26 +0100)
commitde1e2eb7f102e3073714396414592a39efb66b3e
tree7efd251ba421c84521be7d23c93e3245f13a498a
parent792970187f3a420c59879de754b0bbe284aa18c6
usb: typec: wusb3801: fix fwnode refcount leak in wusb3801_probe()

[ Upstream commit dc18a4c7b3bd447cef2395deeb1f6ac16dfaca0e ]

I got the following report while doing fault injection test:

  OF: ERROR: memory leak, expected refcount 1 instead of 4,
  of_node_get()/of_node_put() unbalanced - destroy cset entry:
  attach overlay node /i2c/tcpc@60/connector

If wusb3801_hw_init() fails, fwnode_handle_put() needs be called to
avoid refcount leak.

Fixes: d016cbe4d7ac ("usb: typec: Support the WUSB3801 port controller")
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221203071027.3808308-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/typec/wusb3801.c