]> git.baikalelectronics.ru Git - kernel.git/commit
l2tp: take reference on sessions being dumped
authorGuillaume Nault <g.nault@alphalink.fr>
Mon, 3 Apr 2017 10:03:13 +0000 (12:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Apr 2017 17:00:56 +0000 (10:00 -0700)
commitb8d7f92e2cdd8e27af674095588dc87b74f93f96
tree4caf25fa597dd173c836735c61724499983a9d93
parent179dcf048d25726ab56def1591f96b600b1da19c
l2tp: take reference on sessions being dumped

Take a reference on the sessions returned by l2tp_session_find_nth()
(and rename it l2tp_session_get_nth() to reflect this change), so that
caller is assured that the session isn't going to disappear while
processing it.

For procfs and debugfs handlers, the session is held in the .start()
callback and dropped in .show(). Given that pppol2tp_seq_session_show()
dereferences the associated PPPoL2TP socket and that
l2tp_dfs_seq_session_show() might call pppol2tp_show(), we also need to
call the session's .ref() callback to prevent the socket from going
away from under us.

Fixes: b2079113577e ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Fixes: 1007a7d5783e ("l2tp: Add debugfs files for dumping l2tp debug info")
Fixes: 654563a37b6e ("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>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
net/l2tp/l2tp_debugfs.c
net/l2tp/l2tp_netlink.c
net/l2tp/l2tp_ppp.c