[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201210144623.GA4413@katalix.com>
Date: Thu, 10 Dec 2020 14:46:23 +0000
From: Tom Parkin <tparkin@...alix.com>
To: Guillaume Nault <gnault@...hat.com>
Cc: netdev@...r.kernel.org, jchapman@...alix.com
Subject: Re: [PATCH v3 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and
PPPIOCUNBRIDGECHAN ioctls
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.
> > + 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!
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists