mlxsw: spectrum_router: Update nexthop RIF on update
commit09dbf6297fa8bb4433d9293623b464750d874685
authorPetr Machata <petrm@mellanox.com>
Tue, 28 Nov 2017 12:17:14 +0000 (28 13:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Nov 2017 14:55:48 +0000 (28 09:55 -0500)
tree848a091847fade7c9a03b3c93caf30274343f57d
parentd97cda5f465bacc82659263a885703d73759ea04
mlxsw: spectrum_router: Update nexthop RIF on update

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: 0c5f1cd5ba8c ("mlxsw: spectrum_router: Generalize __mlxsw_sp_ipip_entry_update_tunnel()")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c