]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitf6700294706839c063af9281c0b9ef0706d3ddb7
treec5515fbcf4556919a329c21b4813fce0dae43650
parentb5527522b65228fd673e2e22d8cf8ab6b4be7a63
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: 47384bae9e47 ("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