Re: [PATCH for-3.18 04/15] ppp: take reference on channels netns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 26, 2017 at 02:15:15AM +0530, Amit Pundir wrote:
> From: Guillaume Nault <g.nault@xxxxxxxxxxxx>
> 
> commit 1f461dcdd296eecedaffffc6bae2bfa90bd7eb89 upstream.
> 
> Let channels hold a reference on their network namespace.
> Some channel types, like ppp_async and ppp_synctty, can have their
> userspace controller running in a different namespace. Therefore they
> can't rely on them to preclude their netns from being removed from
> under them.
> 
Hi Amit,

I don't know how you got there, but one chunk is missing in your
backport (same problem happened in your -4.4 series):
@@ -2307,7 +2307,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan)
 
        pch->ppp = NULL;
        pch->chan = chan;
-       pch->chan_net = net;
+       pch->chan_net = get_net(net);
        chan->ppp = pch;
        init_ppp_file(&pch->file, CHANNEL);
        pch->file.hdrlen = chan->hdrlen;

Also, any backport of commit 1f461dcdd296 ("ppp: take reference on channels netns")
should be accompanied by commit 205e1e255c47 ("ppp: defer netns reference release for ppp channel").

Anyway, both are already present in stable/linux-3.18.y, so this patch
can be dropped from your series.
And FWIW, I think linux-3.18.y isn't maintained anymore.

> 
> Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
> Reported-by: Baozeng Ding <sploving1@xxxxxxxxx>
> Signed-off-by: Guillaume Nault <g.nault@xxxxxxxxxxxx>
> Reviewed-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
> Signed-off-by: Amit Pundir <amit.pundir@xxxxxxxxxx>
> ---
>  drivers/net/ppp/ppp_generic.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> index 3dd1c19756ec..38c0231fb9b7 100644
> --- a/drivers/net/ppp/ppp_generic.c
> +++ b/drivers/net/ppp/ppp_generic.c
> @@ -2342,6 +2342,8 @@ ppp_unregister_channel(struct ppp_channel *chan)
>  	spin_lock_bh(&pn->all_channels_lock);
>  	list_del(&pch->list);
>  	spin_unlock_bh(&pn->all_channels_lock);
> +	put_net(pch->chan_net);
> +	pch->chan_net = NULL;
>  
>  	pch->file.dead = 1;
>  	wake_up_interruptible(&pch->file.rwait);
> -- 
> 2.7.4
> 



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]