mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
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: 983db6198f
("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>
This commit is contained in:
parent
c5731cc5eb
commit
ed43cff065
@ -4221,7 +4221,6 @@ mlxsw_sp_fib_entry_ralue_pack(char *ralue_pl,
|
|||||||
|
|
||||||
static int mlxsw_sp_adj_discard_write(struct mlxsw_sp *mlxsw_sp, u16 rif_index)
|
static int mlxsw_sp_adj_discard_write(struct mlxsw_sp *mlxsw_sp, u16 rif_index)
|
||||||
{
|
{
|
||||||
u32 adj_discard_index = mlxsw_sp->router->adj_discard_index;
|
|
||||||
enum mlxsw_reg_ratr_trap_action trap_action;
|
enum mlxsw_reg_ratr_trap_action trap_action;
|
||||||
char ratr_pl[MLXSW_REG_RATR_LEN];
|
char ratr_pl[MLXSW_REG_RATR_LEN];
|
||||||
int err;
|
int err;
|
||||||
@ -4236,8 +4235,8 @@ static int mlxsw_sp_adj_discard_write(struct mlxsw_sp *mlxsw_sp, u16 rif_index)
|
|||||||
|
|
||||||
trap_action = MLXSW_REG_RATR_TRAP_ACTION_DISCARD_ERRORS;
|
trap_action = MLXSW_REG_RATR_TRAP_ACTION_DISCARD_ERRORS;
|
||||||
mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY, true,
|
mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY, true,
|
||||||
MLXSW_REG_RATR_TYPE_ETHERNET, adj_discard_index,
|
MLXSW_REG_RATR_TYPE_ETHERNET,
|
||||||
rif_index);
|
mlxsw_sp->router->adj_discard_index, rif_index);
|
||||||
mlxsw_reg_ratr_trap_action_set(ratr_pl, trap_action);
|
mlxsw_reg_ratr_trap_action_set(ratr_pl, trap_action);
|
||||||
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ratr), ratr_pl);
|
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ratr), ratr_pl);
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
Reference in New Issue
Block a user