diff options
author | Petr Machata <petrm@mellanox.com> | 2017-10-02 12:14:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-02 11:18:57 -0700 |
commit | 28a04c7b7bbecaab642fcb6a2d7354eb70ea7fbe (patch) | |
tree | 7548fe2cae6b85944eb079a41c5421c3f797f1eb /drivers/mcb | |
parent | 81359617f1b783a01e6e22b46cbb046e9513b9c6 (diff) | |
download | op-kernel-dev-28a04c7b7bbecaab642fcb6a2d7354eb70ea7fbe.zip op-kernel-dev-28a04c7b7bbecaab642fcb6a2d7354eb70ea7fbe.tar.gz |
mlxsw: spectrum_router: Move VRF refcounting
When creating a new RIF, bumping RIF count of the containing VR is the
last thing to be done. Symmetrically, when destroying a RIF, RIF count
is first dropped and only then the rest of the cleanup proceeds.
That's a problem for loopback RIFs. Those hold two VR references: one
for overlay and one for underlay. mlxsw_sp_rif_destroy() releases the
overlay one, and the deconfigure() callback the underlay one. But if
both overlay and underlay are the same, and if there are no other
artifacts holding the VR alive, this put actually destroys the VR. Later
on, when mlxsw_sp_rif_destroy() calls mlxsw_sp_vr_put() for the same VR,
the VR will already have been released and the kernel crashes with NULL
pointer dereference.
The underlying problem is that the RIF under destruction ends up
referencing the overlay VR much longer than it claims: all the way until
the call to mlxsw_sp_vr_put(). So line up the reference counting
properly to reflect this. Make corresponding changes in
mlxsw_sp_rif_create() as well for symmetry.
Fixes: 6ddb7426a7d4 ("mlxsw: spectrum_router: Introduce loopback RIFs")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/mcb')
0 files changed, 0 insertions, 0 deletions