mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
mlxsw: spectrum_router: Fix NULL pointer deref
[ Upstream commit8764a8267b] When we remove the neighbour associated with a nexthop we should always refuse to write the nexthop to the adjacency table. Regardless if it is already present in the table or not. Otherwise, we risk dereferencing the NULL pointer that was set instead of the neighbour. Fixes:a7ff87acd9("mlxsw: spectrum_router: Implement next-hop routing") Signed-off-by: Ido Schimmel <idosch@mellanox.com> Reported-by: Alexander Petrovskiy <alexpe@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
16d5b481d0
commit
e2b825e8de
@@ -1328,9 +1328,9 @@ set_trap:
|
||||
static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh,
|
||||
bool removing)
|
||||
{
|
||||
if (!removing && !nh->should_offload)
|
||||
if (!removing)
|
||||
nh->should_offload = 1;
|
||||
else if (removing && nh->offloaded)
|
||||
else
|
||||
nh->should_offload = 0;
|
||||
nh->update = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user