summaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_debugfs.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2018-05-09 11:58:20 -0700
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-05-09 11:59:07 -0700
commit9935448e207cc9e7e5fd3c6aa3282ff503f263c4 (patch)
treea43f75f5dd940664f468418d59d3879ffff75b8f /net/l2tp/l2tp_debugfs.c
parent41a5985f173bf1f93d2634fc93d8aa53683067f9 (diff)
parent75bc37fefc4471e718ba8e651aa74673d4e0a9eb (diff)
downloadlinux-9935448e207cc9e7e5fd3c6aa3282ff503f263c4.tar.gz
linux-9935448e207cc9e7e5fd3c6aa3282ff503f263c4.tar.bz2
linux-9935448e207cc9e7e5fd3c6aa3282ff503f263c4.zip
Merge tag 'v4.17-rc4' into rproc-next
Pick up fixes from rproc-v4.17-1 Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'net/l2tp/l2tp_debugfs.c')
-rw-r--r--net/l2tp/l2tp_debugfs.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c
index 72e713da4733..7f1e842ef05a 100644
--- a/net/l2tp/l2tp_debugfs.c
+++ b/net/l2tp/l2tp_debugfs.c
@@ -47,7 +47,11 @@ struct l2tp_dfs_seq_data {
static void l2tp_dfs_next_tunnel(struct l2tp_dfs_seq_data *pd)
{
- pd->tunnel = l2tp_tunnel_find_nth(pd->net, pd->tunnel_idx);
+ /* Drop reference taken during previous invocation */
+ if (pd->tunnel)
+ l2tp_tunnel_dec_refcount(pd->tunnel);
+
+ pd->tunnel = l2tp_tunnel_get_nth(pd->net, pd->tunnel_idx);
pd->tunnel_idx++;
}
@@ -96,7 +100,17 @@ static void *l2tp_dfs_seq_next(struct seq_file *m, void *v, loff_t *pos)
static void l2tp_dfs_seq_stop(struct seq_file *p, void *v)
{
- /* nothing to do */
+ struct l2tp_dfs_seq_data *pd = v;
+
+ if (!pd || pd == SEQ_START_TOKEN)
+ return;
+
+ /* Drop reference taken by last invocation of l2tp_dfs_next_tunnel() */
+ if (pd->tunnel) {
+ l2tp_tunnel_dec_refcount(pd->tunnel);
+ pd->tunnel = NULL;
+ pd->session = NULL;
+ }
}
static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v)