Skip to contentSkip to conversation

mlxsw: spectrum_router: Fix NULL pointer deref

PATCH In review Jiri Pirko 2 participants 3 messages Dec 25, 2017 – Jan 2, 2018

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 mlxsw: spectrum_router: Fix NULL pointer deref

From: Ido Schimmel <[email protected]>

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")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -1
index be657b8..434b392 100644
@@ -3228,7 +3228,7 @@ static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh,
 {
 	if (!removing)
 		nh->should_offload = 1;
-	else if (nh->offloaded)
+	else
 		nh->should_offload = 0;
 	nh->update = 1;
 }
Signature · 1 line
2.9.5
author
#1 lore raw
Quoted 6 lines · Mon, Dec 25, 2017 at 08:57:35AM CET, [email protected] wrote:

From: Ido Schimmel <[email protected]>

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.

Quoted 7 lines

Otherwise, we risk dereferencing the NULL pointer that was set instead of the neighbour.

Fixes a7ff87acd995 ("mlxsw: spectrum_router: Implement next-hop routing")

Dave, could you please queue this up for 4.14.y together with "mlxsw: spectrum: Relax sanity checks during enslavement".

Thanks!

maintainer
#2 lore raw

From: Jiri Pirko <[email protected]>
Date: Mon, 25 Dec 2017 09:02:54 +0100

Quoted 10 lines
Quoted 9 lines · Mon, Dec 25, 2017 at 08:57:35AM CET, [email protected] wrote:

From: Ido Schimmel <[email protected]>

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.

Quoted 7 lines
Quoted 4 lines
Fixes a7ff87acd995 ("mlxsw: spectrum_router: Implement next-hop routing")

Dave, could you please queue this up for 4.14.y together with "mlxsw: spectrum: Relax sanity checks during enslavement".

Both applied and queued up for -stable.