diff options
author | Tom Parkin <tparkin@katalix.com> | 2021-01-07 21:13:15 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-09 06:21:06 +0300 |
commit | c1787ffd0d24eb93eefac2dbba0eac5700da9ff1 (patch) | |
tree | 94c6123b8703bfcd561b99bfceaadff453e38b5a /net/switchdev/switchdev.c | |
parent | fd2ddef043592e7de80af53f47fa46fd3573086e (diff) | |
download | linux-c1787ffd0d24eb93eefac2dbba0eac5700da9ff1.tar.xz |
ppp: fix refcount underflow on channel unbridge
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.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Fixes: 4cf476ced45d ("ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls")
Acked-by: Guillaume Nault <gnault@redhat.com>
Link: https://lore.kernel.org/r/20210107181315.3128-1-tparkin@katalix.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/switchdev/switchdev.c')
0 files changed, 0 insertions, 0 deletions