]> git.baikalelectronics.ru Git - kernel.git/commit
drivers: ethernet: cpsw: fix panic when interrupt coaleceing is set via ethtool
authorSondhauß, Jan <Jan.Sondhauss@wago.com>
Wed, 23 Mar 2022 08:47:33 +0000 (08:47 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 23 Mar 2022 17:46:42 +0000 (10:46 -0700)
commitaf3f570590550681bd7a9b269a15dfb4fcc9a4a0
tree4efe28172eeda5bff67df1404cc40690e98bd246
parent0d80add8e280cb3a10d144f35b6d58c19268b66c
drivers: ethernet: cpsw: fix panic when interrupt coaleceing is set via ethtool

cpsw_ethtool_begin directly returns the result of pm_runtime_get_sync
when successful.
pm_runtime_get_sync returns -error code on failure and 0 on successful
resume but also 1 when the device is already active. So the common case
for cpsw_ethtool_begin is to return 1. That leads to inconsistent calls
to pm_runtime_put in the call-chain so that pm_runtime_put is called
one too many times and as result leaving the cpsw dev behind suspended.

The suspended cpsw dev leads to an access violation later on by
different parts of the cpsw driver.

Fix this by calling the return-friendly pm_runtime_resume_and_get
function.

Fixes: 29962bafb08b ("ethtool: runtime-resume netdev parent in ethnl_ops_begin")
Signed-off-by: Jan Sondhauss <jan.sondhauss@wago.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20220323084725.65864-1-jan.sondhauss@wago.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/cpsw_ethtool.c