]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
l2tp: fix race in duplicate tunnel detection
authorGuillaume Nault <g.nault@alphalink.fr>
Tue, 10 Apr 2018 19:01:13 +0000 (21:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Apr 2018 06:55:07 +0000 (08:55 +0200)
commita818b1e8182ec7c1a4201f3cbdba3a43f37e982f
tree695ba5fad458bb03e5c8e49dde77f25aef07126d
parent186fab54f609903110a93bfe742f513b8d7d8221
l2tp: fix race in duplicate tunnel detection

[ Upstream commit f6cd651b056ffd3b4e8496afd44d4ed44bf69136 ]

We can't use l2tp_tunnel_find() to prevent l2tp_nl_cmd_tunnel_create()
from creating a duplicate tunnel. A tunnel can be concurrently
registered after l2tp_tunnel_find() returns. Therefore, searching for
duplicates must be done at registration time.

Finally, remove l2tp_tunnel_find() entirely as it isn't use anywhere
anymore.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
net/l2tp/l2tp_netlink.c