caif-hsi: fix possible deadlock in cfhsi_exit_module() [Linux 4.4.187]

This Linux kernel change "caif-hsi: fix possible deadlock in cfhsi_exit_module()" is included in the Linux 4.4.187 release. This change is authored by Taehee Yoo <ap420073 [at] gmail.com> on Mon Jul 15 14:10:17 2019 +0900. The commit for this change in Linux stable tree is 4d285dc (patch) which is from upstream commit fdd258d. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream fdd258d.

caif-hsi: fix possible deadlock in cfhsi_exit_module()

[ Upstream commit fdd258d49e88a9e0b49ef04a506a796f1c768a8e ]

cfhsi_exit_module() calls unregister_netdev() under rtnl_lock().
but unregister_netdev() internally calls rtnl_lock().
So deadlock would occur.

Fixes: c41254006377 ("caif-hsi: Add rtnl support")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/caif/caif_hsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 615c65d..055a401 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -1467,7 +1467,7 @@ static void __exit cfhsi_exit_module(void)
    rtnl_lock();
    list_for_each_safe(list_node, n, &cfhsi_list) {
        cfhsi = list_entry(list_node, struct cfhsi, list);
-       unregister_netdev(cfhsi->ndev);
+       unregister_netdevice(cfhsi->ndev);
    }
    rtnl_unlock();
 }

Leave a Reply

Your email address will not be published. Required fields are marked *