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!

Attachment: signature.asc
Description: PGP signature

Reply via email to