Skip to content

Commit

Permalink
l2tp: add netns refcount tracker to l2tp_dfs_seq_data
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Eric Dumazet authored and kuba-moo committed Dec 10, 2021
1 parent dbdcda6 commit 285ec2f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/l2tp/l2tp_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
static struct dentry *rootdir;

struct l2tp_dfs_seq_data {
struct net *net;
struct net *net;
netns_tracker ns_tracker;
int tunnel_idx; /* current tunnel */
int session_idx; /* index of session within current tunnel */
struct l2tp_tunnel *tunnel;
Expand Down Expand Up @@ -281,7 +282,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file)
rc = PTR_ERR(pd->net);
goto err_free_pd;
}

netns_tracker_alloc(pd->net, &pd->ns_tracker, GFP_KERNEL);
rc = seq_open(file, &l2tp_dfs_seq_ops);
if (rc)
goto err_free_net;
Expand All @@ -293,7 +294,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file)
return rc;

err_free_net:
put_net(pd->net);
put_net_track(pd->net, &pd->ns_tracker);
err_free_pd:
kfree(pd);
goto out;
Expand All @@ -307,7 +308,7 @@ static int l2tp_dfs_seq_release(struct inode *inode, struct file *file)
seq = file->private_data;
pd = seq->private;
if (pd->net)
put_net(pd->net);
put_net_track(pd->net, &pd->ns_tracker);
kfree(pd);
seq_release(inode, file);

Expand Down

0 comments on commit 285ec2f

Please sign in to comment.