VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Xiyu Yang <xiyuyang19@fudan.edu.cn> 2021-09-09 12:32:00 +0800 committer: David S. Miller <davem@davemloft.net> 2021-09-09 11:00:20 +0100 commit: 9b6ff7eb666415e1558f1ba8a742f5db6a9954de parent: 04f08eb44b5011493d77b602fdec29ff0f5c6cd5
Commit Summary:
net/l2tp: Fix reference count leak in l2tp_udp_recv_core
Diffstat:
1 file changed, 3 insertions, 1 deletion
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 53486b162f01..93271a2632b8 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -869,8 +869,10 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb)
 	}
 
 	if (tunnel->version == L2TP_HDR_VER_3 &&
-	    l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr))
+	    l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) {
+		l2tp_session_dec_refcount(session);
 		goto invalid;
+	}
 
 	l2tp_recv_common(session, skb, ptr, optr, hdrflags, length);
 	l2tp_session_dec_refcount(session);