diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2017-03-31 13:02:30 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-05 14:40:19 +0200 |
commit | 08cb8e5f83fd2d4f6327173cc01322bc842806f1 (patch) | |
tree | a73b1f9d8589ea71ca891799d5650a13322da167 /mm/huge_memory.c | |
parent | 599e6f038777c6733eef244d4aac192edb612aa6 (diff) | |
download | linux-stable-08cb8e5f83fd2d4f6327173cc01322bc842806f1.tar.gz linux-stable-08cb8e5f83fd2d4f6327173cc01322bc842806f1.tar.bz2 linux-stable-08cb8e5f83fd2d4f6327173cc01322bc842806f1.zip |
l2tp: take a reference on sessions used in genetlink handlers
commit 2777e2ab5a9cf2b4524486c6db1517a6ded25261 upstream.
Callers of l2tp_nl_session_find() need to hold a reference on the
returned session since there's no guarantee that it isn't going to
disappear from under them.
Relying on the fact that no l2tp netlink message may be processed
concurrently isn't enough: sessions can be deleted by other means
(e.g. by closing the PPPOL2TP socket of a ppp pseudowire).
l2tp_nl_cmd_session_delete() is a bit special: it runs a callback
function that may require a previous call to session->ref(). In
particular, for ppp pseudowires, the callback is l2tp_session_delete(),
which then calls pppol2tp_session_close() and dereferences the PPPOL2TP
socket. The socket might already be gone at the moment
l2tp_session_delete() calls session->ref(), so we need to take a
reference during the session lookup. So we need to pass the do_ref
variable down to l2tp_session_get() and l2tp_session_get_by_ifname().
Since all callers have to be updated, l2tp_session_find_by_ifname() and
l2tp_nl_session_find() are renamed to reflect their new behaviour.
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: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/huge_memory.c')
0 files changed, 0 insertions, 0 deletions