aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_core.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--net/l2tp/l2tp_core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 50548c61b91e..e723828e458b 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1564,10 +1564,12 @@ void l2tp_session_free(struct l2tp_session *session)
struct l2tp_tunnel *tunnel = session->tunnel;
if (tunnel) {
- BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC);
+ if (WARN_ON(tunnel->magic != L2TP_TUNNEL_MAGIC))
+ goto out;
l2tp_tunnel_dec_refcount(tunnel);
}
+out:
kfree(session);
}
EXPORT_SYMBOL_GPL(l2tp_session_free);