[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201210150551.GB15778@linux.home>
Date: Thu, 10 Dec 2020 16:05:51 +0100
From: Guillaume Nault <gnault@...hat.com>
To: Tom Parkin <tparkin@...alix.com>
Cc: netdev@...r.kernel.org, jchapman@...alix.com
Subject: Re: [PATCH v3 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and
PPPIOCUNBRIDGECHAN ioctls
On Thu, Dec 10, 2020 at 02:46:23PM +0000, Tom Parkin wrote:
> On Mon, Dec 07, 2020 at 17:22:28 +0100, Guillaume Nault wrote:
> > On Fri, Dec 04, 2020 at 04:36:55PM +0000, Tom Parkin wrote:
> > > + case PPPIOCBRIDGECHAN:
> > > + if (get_user(unit, p))
> > > + break;
> > > + err = -ENXIO;
> > > + pn = ppp_pernet(current->nsproxy->net_ns);
> > > + spin_lock_bh(&pn->all_channels_lock);
> > > + pchb = ppp_find_channel(pn, unit);
> > > + /* Hold a reference to prevent pchb being freed while
> > > + * we establish the bridge.
> > > + */
> > > + if (pchb)
> > > + refcount_inc(&pchb->file.refcnt);
> >
> > The !pchb case isn't handled. With this code, if ppp_find_channel()
> > returns NULL, ppp_bridge_channels() will crash when trying to lock
> > pchb->upl.
>
> Bleh :-(
>
> Apologies for this. I have stepped up my tests for "unhappy" code
> paths, and I'll try to run syzkaller at a v4 prior to re-submitting.
No problem, sorry for not having spotted the problem in your previous
version. BTW, note that net-next is probably about to close.
> > > + spin_unlock_bh(&pn->all_channels_lock);
> > > + err = ppp_bridge_channels(pch, pchb);
> > > + /* Drop earlier refcount now bridge establishment is complete */
> > > + if (refcount_dec_and_test(&pchb->file.refcnt))
> > > + ppp_destroy_channel(pchb);
> > > + break;
> > > +
> >
> > The rest looks good to me.
>
> Thanks!
Powered by blists - more mailing lists