l2tp: initialise session's refcount before making it reachable
authorGuillaume Nault <g.nault@alphalink.fr>
Fri, 25 Aug 2017 14:22:17 +0000 (16:22 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:33 +0000 (13:34 +0000)
commit81beca86edb32fbf5cec019d522889b765539639
tree39e8f4140f17a13e5ae9f8bf1d6f46cc1b2a0983
parent62b3046afa78f34d1e05997ce86e4ce6f2f060d1
l2tp: initialise session's refcount before making it reachable

commit 9ee369a405c57613d7c83a3967780c3e30c52ecc upstream.

Sessions must be fully initialised before calling
l2tp_session_add_to_tunnel(). Otherwise, there's a short time frame
where partially initialised sessions can be accessed by external users.

Fixes: dbdbc73b4478 ("l2tp: fix duplicate session creation")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2: keep using l2tp_session_inc_refcount()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/l2tp/l2tp_core.c