All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Tom Parkin <tparkin@katalix.com>
Cc: netdev@vger.kernel.org, jchapman@katalix.com
Subject: Re: [PATCH v3 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls
Date: Thu, 10 Dec 2020 16:05:51 +0100	[thread overview]
Message-ID: <20201210150551.GB15778@linux.home> (raw)
In-Reply-To: <20201210144623.GA4413@katalix.com>

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!



  reply	other threads:[~2020-12-10 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 16:36 [PATCH v3 net-next 0/2] add ppp_generic ioctl(s) to bridge channels Tom Parkin
2020-12-04 16:36 ` [PATCH v3 net-next 1/2] ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls Tom Parkin
2020-12-07 16:22   ` Guillaume Nault
2020-12-10 14:46     ` Tom Parkin
2020-12-10 15:05       ` Guillaume Nault [this message]
2020-12-04 16:36 ` [PATCH v3 net-next 2/2] docs: update ppp_generic.rst to document new ioctls Tom Parkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210150551.GB15778@linux.home \
    --to=gnault@redhat.com \
    --cc=jchapman@katalix.com \
    --cc=netdev@vger.kernel.org \
    --cc=tparkin@katalix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.