aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_eth.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-06-06 20:07:20 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-07 16:02:20 -0400
commita06998b88b1651c5f71c0e35f528bf2057188ead (patch)
tree440f4da0f692186c728d5a1ebff7889c6844461d /net/l2tp/l2tp_eth.c
parentda2e852612967a53d17de930929574444a67fb52 (diff)
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: Eric Dumazet <edumazet@google.com> Reported-by: Denys Fedoryshchenko <denys@visp.net.lb> Tested-by: Denys Fedoryshchenko <denys@visp.net.lb> Cc: James Chapman <jchapman@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp/l2tp_eth.c')
-rw-r--r--net/l2tp/l2tp_eth.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 443591d629ca..185f12f4a5fa 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -162,6 +162,7 @@ static void l2tp_eth_delete(struct l2tp_session *session)
162 if (dev) { 162 if (dev) {
163 unregister_netdev(dev); 163 unregister_netdev(dev);
164 spriv->dev = NULL; 164 spriv->dev = NULL;
165 module_put(THIS_MODULE);
165 } 166 }
166 } 167 }
167} 168}
@@ -249,6 +250,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
249 if (rc < 0) 250 if (rc < 0)
250 goto out_del_dev; 251 goto out_del_dev;
251 252
253 __module_get(THIS_MODULE);
252 /* Must be done after register_netdev() */ 254 /* Must be done after register_netdev() */
253 strlcpy(session->ifname, dev->name, IFNAMSIZ); 255 strlcpy(session->ifname, dev->name, IFNAMSIZ);
254 256