From: Tom Parkin <tparkin@katalix.com>
To: Guillaume Nault <gnault@redhat.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 14:46:23 +0000 [thread overview]
Message-ID: <20201210144623.GA4413@katalix.com> (raw)
In-Reply-To: <20201207162228.GA28888@linux.home>
[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-12-10 15:13 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 [this message]
2020-12-10 15:05 ` Guillaume Nault
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=20201210144623.GA4413@katalix.com \
--to=tparkin@katalix.com \
--cc=gnault@redhat.com \
--cc=jchapman@katalix.com \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).