[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210106123353.1ac8d367@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 6 Jan 2021 12:33:53 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Tom Parkin <tparkin@...alix.com>
Cc: netdev@...r.kernel.org, gnault@...hat.com, jchapman@...alix.com
Subject: Re: [PATCH] ppp: fix refcount underflow on channel unbridge
On Tue, 5 Jan 2021 21:17:43 +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.
Please prefix the subject with [PATCH net v3] for v3, add a fixes tag,
and make sure to include you sign-off.
Powered by blists - more mailing lists