mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
l2tp: add netns refcount tracker to l2tp_dfs_seq_data
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
dbdcda634c
commit
285ec2fef4
1 changed files with 5 additions and 4 deletions
|
@ -32,7 +32,8 @@
|
||||||
static struct dentry *rootdir;
|
static struct dentry *rootdir;
|
||||||
|
|
||||||
struct l2tp_dfs_seq_data {
|
struct l2tp_dfs_seq_data {
|
||||||
struct net *net;
|
struct net *net;
|
||||||
|
netns_tracker ns_tracker;
|
||||||
int tunnel_idx; /* current tunnel */
|
int tunnel_idx; /* current tunnel */
|
||||||
int session_idx; /* index of session within current tunnel */
|
int session_idx; /* index of session within current tunnel */
|
||||||
struct l2tp_tunnel *tunnel;
|
struct l2tp_tunnel *tunnel;
|
||||||
|
@ -281,7 +282,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file)
|
||||||
rc = PTR_ERR(pd->net);
|
rc = PTR_ERR(pd->net);
|
||||||
goto err_free_pd;
|
goto err_free_pd;
|
||||||
}
|
}
|
||||||
|
netns_tracker_alloc(pd->net, &pd->ns_tracker, GFP_KERNEL);
|
||||||
rc = seq_open(file, &l2tp_dfs_seq_ops);
|
rc = seq_open(file, &l2tp_dfs_seq_ops);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err_free_net;
|
goto err_free_net;
|
||||||
|
@ -293,7 +294,7 @@ out:
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
err_free_net:
|
err_free_net:
|
||||||
put_net(pd->net);
|
put_net_track(pd->net, &pd->ns_tracker);
|
||||||
err_free_pd:
|
err_free_pd:
|
||||||
kfree(pd);
|
kfree(pd);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -307,7 +308,7 @@ static int l2tp_dfs_seq_release(struct inode *inode, struct file *file)
|
||||||
seq = file->private_data;
|
seq = file->private_data;
|
||||||
pd = seq->private;
|
pd = seq->private;
|
||||||
if (pd->net)
|
if (pd->net)
|
||||||
put_net(pd->net);
|
put_net_track(pd->net, &pd->ns_tracker);
|
||||||
kfree(pd);
|
kfree(pd);
|
||||||
seq_release(inode, file);
|
seq_release(inode, file);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue