]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_router: Free LPM tree upon failure
authorIdo Schimmel <idosch@mellanox.com>
Thu, 18 Jan 2018 14:42:10 +0000 (15:42 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Jan 2018 01:54:58 +0000 (20:54 -0500)
commitc2f19249260b18c42844ba1f9d166e2ae7a7c181
tree858fc00d3d83135c84ae254d88fab682c8809455
parent3055234159f21ee007bf36a3780db3b0b0dd3f3b
mlxsw: spectrum_router: Free LPM tree upon failure

When a new LPM tree is created, we try to replace the trees in the
existing virtual routers with it. If we fail, the tree needs to be
freed.

Currently, this does not happen in the unlikely case where we fail to
bind the tree to the first virtual router, since its reference count
never transitions from 1 to 0.

Fix that by taking a reference before binding the tree.

Fixes: ba9238dbb5e6 ("mlxsw: spectrum_router: Use one LPM tree for all virtual routers")
Signed-off-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