l2tp: hold tunnel used while creating sessions with netlink
authorGuillaume Nault <g.nault@alphalink.fr>
Fri, 25 Aug 2017 14:51:46 +0000 (16:51 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:35 +0000 (13:34 +0000)
commita0fd6e87599055abd81716c16fbc5c13df8528e8
tree3cebc460f21f5542a4aae5e618cca65676733230
parentd47ca949d189f932857182fe098a6513a4d2545a
l2tp: hold tunnel used while creating sessions with netlink

commit e702c1204eb57788ef189c839c8c779368267d70 upstream.

Use l2tp_tunnel_get() to retrieve tunnel, so that it can't go away on
us. Otherwise l2tp_tunnel_destruct() might release the last reference
count concurrently, thus freeing the tunnel while we're using it.

Fixes: 309795f4bec2 ("l2tp: Add netlink control API for L2TP")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/l2tp/l2tp_netlink.c