]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: fec: Fix reference count leak in fec series ops
authorZhang Qilong <zhangqilong3@huawei.com>
Tue, 10 Nov 2020 09:29:33 +0000 (17:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:38:51 +0000 (13:38 +0100)
commitca5bbd0fdd36e0430d7e5b79e0a68d5065ee0e53
treeac7a1196e5519cddb45cc6d066265afe8ec5e750
parent535a1c43fdf5d568e24a497094df835844e79fcd
net: fec: Fix reference count leak in fec series ops

[ Upstream commit da875fa5040b0f951cb4bf7efbf59f6dcff44d3c ]

pm_runtime_get_sync() will increment pm usage at first and it will
resume the device later. If runtime of the device has error or
device is in inaccessible state(or other error state), resume
operation will fail. If we do not call put operation to decrease
the reference, it will result in reference count leak. Moreover,
this device cannot enter the idle state and always stay busy or other
non-idle state later. So we fixed it by replacing it with
pm_runtime_resume_and_get.

Fixes: 8fff755e9f8d0 ("net: fec: Ensure clocks are enabled while using mdio bus")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/freescale/fec_main.c