netdev.vger.kernel.org archive mirror
 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 net v3] ppp: fix refcount underflow on channel unbridge
Date: Fri, 8 Jan 2021 21:57:50 +0100	[thread overview]
Message-ID: <20210108205750.GA14215@linux.home> (raw)
In-Reply-To: <20210107181315.3128-1-tparkin@katalix.com>

On Thu, Jan 07, 2021 at 06:13:15PM +0000, Tom Parkin wrote:
> When setting up a channel bridge, ppp_bridge_channels sets the
> pch->bridge field before taking the associated reference on the bridge
> file instance.
> 
> This opens up a refcount underflow bug if ppp_bridge_channels called
> via. iotcl runs concurrently with ppp_unbridge_channels executing via.
> file release.
> 
> The bug is triggered by ppp_bridge_channels taking the error path
> through the 'err_unset' label.  In this scenario, pch->bridge is set,
> but the reference on the bridged channel will not be taken because
> the function errors out.  If ppp_unbridge_channels observes pch->bridge
> before it is unset by the error path, it will erroneously drop the
> reference on the bridged channel and cause a refcount underflow.
> 
> To avoid this, ensure that ppp_bridge_channels holds a reference on
> each channel in advance of setting the bridge pointers.

Thanks for following up on this!

Acked-by: Guillaume Nault <gnault@redhat.com>


  reply	other threads:[~2021-01-08 20:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 18:13 [PATCH net v3] ppp: fix refcount underflow on channel unbridge Tom Parkin
2021-01-08 20:57 ` Guillaume Nault [this message]
2021-01-09  3:23   ` Jakub Kicinski
2021-01-11 10:28   ` 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=20210108205750.GA14215@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 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).