From: Ido Schimmel Date: Mon, 22 Mar 2021 15:58:44 +0000 (+0200) Subject: mlxsw: spectrum_router: Only provide MAC address for valid nexthops X-Git-Tag: v5.13-rc1~94^2~439^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6a5011bec0962cfddcce48065e29c65e9a6ec18;p=thirdparty%2Flinux.git mlxsw: spectrum_router: Only provide MAC address for valid nexthops The helper returns the MAC address associated with the nexthop. It is only valid when the nexthop forwards packets and when it is an Ethernet nexthop. Reflect this in the checks the helper is performing. This is not an issue because the sole caller of the function only invokes it for such nexthops. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 593a40aa9af88..b7358cf611c17 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -2986,7 +2986,8 @@ bool mlxsw_sp_nexthop_is_forward(const struct mlxsw_sp_nexthop *nh) unsigned char *mlxsw_sp_nexthop_ha(struct mlxsw_sp_nexthop *nh) { - if (!nh->offloaded) + if (nh->type != MLXSW_SP_NEXTHOP_TYPE_ETH || + !mlxsw_sp_nexthop_is_forward(nh)) return NULL; return nh->neigh_entry->ha; }