Skip to content
Commit 165df241 authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller
Browse files

net: mdiobus: fix double put fwnode in the error path

If phy_device_register() or fwnode_mdiobus_phy_device_register()
fail, phy_device_free() is called, the device refcount is decreased
to 0, then fwnode_handle_put() will be called in phy_device_release(),
but in the error path, fwnode_handle_put() has already been called,
so set fwnode to NULL after fwnode_handle_put() in the error path to
avoid double put.

Fixes: cdde1560

 ("net: mdiobus: fix unbalanced node reference count")
Reported-by: default avatarZeng Heng <zengheng4@huawei.com>
Tested-by: default avatarZeng Heng <zengheng4@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarZeng Heng <zengheng4@huawei.com>
Tested-by: default avatarZeng Heng <zengheng4@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25f427ac
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment