mlxsw: spectrum_router: Fix use of uninitialized adjacency index
authorAmit Cohen <amitc@mellanox.com>
Sun, 24 Nov 2019 07:48:03 +0000 (09:48 +0200)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Mon, 25 Nov 2019 02:34:46 +0000 (18:34 -0800)
commited43cff065d7ca2ffa60a7a1ea62be4a574529f9
treec5515fbcf4556919a329c21b4813fce0dae43650
parentc5731cc5ebcbfdb0b34c7ce29d488c52d8af957b
mlxsw: spectrum_router: Fix use of uninitialized adjacency index

When mlxsw_sp_adj_discard_write() is called for the first time, the
value stored in 'mlxsw_sp->router->adj_discard_index' is invalid, as
indicated by 'mlxsw_sp->router->adj_discard_index_valid' being set to
'false'.

In this case, we should not use the value initially stored in
'mlxsw_sp->router->adj_discard_index' (0) and instead use the value
allocated later in the function.

Fixes: 983db6198f0d ("mlxsw: spectrum_router: Allocate discard adjacency entry when needed")
Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c