l2tp: hold tunnel used while creating sessions with netlink
authorGuillaume Nault <g.nault@alphalink.fr>
Thu, 21 May 2020 23:39:30 +0000 (00:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 May 2020 14:41:57 +0000 (16:41 +0200)
commite20c980a2bf6991507d70ff7d221af394db07c76
treea86fb8a4b62c49d268ac0ece79eae9c22bac0e58
parent4c15cdb962d27d5b095fd444156c0746993df377
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: Giuliano Procida <gprocida@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/l2tp/l2tp_netlink.c