]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_router: Fix rollback in tunnel next hop init
authorPetr Machata <petrm@nvidia.com>
Wed, 29 Jun 2022 07:02:05 +0000 (10:02 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 30 Jun 2022 09:35:18 +0000 (11:35 +0200)
commit024cc509eae4d26049ba2af38f0c293f3c1f724d
treebcc947cf8f2a8e92e963d7524e097c9db3f3b18a
parent9822c2d1381ecf1f47a3c538ada0d8946cce5a47
mlxsw: spectrum_router: Fix rollback in tunnel next hop init

In mlxsw_sp_nexthop6_init(), a next hop is always added to the router
linked list, and mlxsw_sp_nexthop_type_init() is invoked afterwards. When
that function results in an error, the next hop will not have been removed
from the linked list. As the error is propagated upwards and the caller
frees the next hop object, the linked list ends up holding an invalid
object.

A similar issue comes up with mlxsw_sp_nexthop4_init(), where rollback
block does exist, however does not include the linked list removal.

Both IPv6 and IPv4 next hops have a similar issue with next-hop counter
rollbacks. As these were introduced in the same patchset as the next hop
linked list, include the cleanup in this patch.

Fixes: 4e4a8cbe8a97 ("mlxsw: spectrum_router: Keep nexthops in a linked list")
Fixes: 57b8fd70b9c8 ("mlxsw: spectrum: Add support for setting counters on nexthops")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20220629070205.803952-1-idosch@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c