提交 a06998b8 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net: l2tp_eth: fix kernel panic on rmmod l2tp_eth

We must prevent module unloading if some devices are still attached to
l2tp_eth driver.
Signed-off-by: NEric Dumazet <edumazet@google.com>
Reported-by: NDenys Fedoryshchenko <denys@visp.net.lb>
Tested-by: NDenys Fedoryshchenko <denys@visp.net.lb>
Cc: James Chapman <jchapman@katalix.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 da2e8526
...@@ -162,6 +162,7 @@ static void l2tp_eth_delete(struct l2tp_session *session) ...@@ -162,6 +162,7 @@ static void l2tp_eth_delete(struct l2tp_session *session)
if (dev) { if (dev) {
unregister_netdev(dev); unregister_netdev(dev);
spriv->dev = NULL; spriv->dev = NULL;
module_put(THIS_MODULE);
} }
} }
} }
...@@ -249,6 +250,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p ...@@ -249,6 +250,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
if (rc < 0) if (rc < 0)
goto out_del_dev; goto out_del_dev;
__module_get(THIS_MODULE);
/* Must be done after register_netdev() */ /* Must be done after register_netdev() */
strlcpy(session->ifname, dev->name, IFNAMSIZ); strlcpy(session->ifname, dev->name, IFNAMSIZ);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册