• Petr Machata's avatar
    mlxsw: spectrum_router: Update nexthop RIF on update · 09dbf629
    Petr Machata authored
    The function mlxsw_sp_nexthop_rif_update() walks the list of nexthops
    associated with a RIF, and updates the corresponding entries in the
    switch. It is used in particular when a tunnel underlay netdevice moves
    to a different VRF, and all the nexthops are migrated over to a new RIF.
    The problem is that each nexthop holds a reference to its RIF, and that
    is not updated. So after the old RIF is gone, further activity on these
    nexthops (such as downing the underlay netdevice) dereferences a
    dangling pointer.
    
    Fix the issue by updating rif of impacted nexthops before calling
    mlxsw_sp_nexthop_rif_update().
    
    Fixes: 0c5f1cd5 ("mlxsw: spectrum_router: Generalize __mlxsw_sp_ipip_entry_update_tunnel()")
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    09dbf629
spectrum_router.c 189 KB