Commit 11b311a8 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

ppp: add netns refcount tracker

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 285ec2fe
...@@ -173,6 +173,7 @@ struct channel { ...@@ -173,6 +173,7 @@ struct channel {
spinlock_t downl; /* protects `chan', file.xq dequeue */ spinlock_t downl; /* protects `chan', file.xq dequeue */
struct ppp *ppp; /* ppp unit we're connected to */ struct ppp *ppp; /* ppp unit we're connected to */
struct net *chan_net; /* the net channel belongs to */ struct net *chan_net; /* the net channel belongs to */
netns_tracker ns_tracker;
struct list_head clist; /* link in list of channels per unit */ struct list_head clist; /* link in list of channels per unit */
rwlock_t upl; /* protects `ppp' and 'bridge' */ rwlock_t upl; /* protects `ppp' and 'bridge' */
struct channel __rcu *bridge; /* "bridged" ppp channel */ struct channel __rcu *bridge; /* "bridged" ppp channel */
...@@ -2879,7 +2880,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan) ...@@ -2879,7 +2880,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan)
pch->ppp = NULL; pch->ppp = NULL;
pch->chan = chan; pch->chan = chan;
pch->chan_net = get_net(net); pch->chan_net = get_net_track(net, &pch->ns_tracker, GFP_KERNEL);
chan->ppp = pch; chan->ppp = pch;
init_ppp_file(&pch->file, CHANNEL); init_ppp_file(&pch->file, CHANNEL);
pch->file.hdrlen = chan->hdrlen; pch->file.hdrlen = chan->hdrlen;
...@@ -3519,7 +3520,7 @@ ppp_disconnect_channel(struct channel *pch) ...@@ -3519,7 +3520,7 @@ ppp_disconnect_channel(struct channel *pch)
*/ */
static void ppp_destroy_channel(struct channel *pch) static void ppp_destroy_channel(struct channel *pch)
{ {
put_net(pch->chan_net); put_net_track(pch->chan_net, &pch->ns_tracker);
pch->chan_net = NULL; pch->chan_net = NULL;
atomic_dec(&channel_count); atomic_dec(&channel_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment