瀏覽代碼

mlxsw: spectrum_router: Fix NULL pointer deref

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: a7ff87acd995 ("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>
Ido Schimmel 8 年之前
父節點
當前提交
8764a8267b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

+ 1 - 1
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

@@ -3228,7 +3228,7 @@ static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh,
 {
 {
 	if (!removing)
 	if (!removing)
 		nh->should_offload = 1;
 		nh->should_offload = 1;
-	else if (nh->offloaded)
+	else
 		nh->should_offload = 0;
 		nh->should_offload = 0;
 	nh->update = 1;
 	nh->update = 1;
 }
 }