]>
Commit | Line | Data |
---|---|---|
a9fba688 SL |
1 | From 12bc33bca64c30486d9f18472c4a9ad69907c4b5 Mon Sep 17 00:00:00 2001 |
2 | From: Gavi Teitz <gavi@mellanox.com> | |
3 | Date: Mon, 11 Mar 2019 11:56:34 +0200 | |
4 | Subject: net/mlx5e: Fix error handling when refreshing TIRs | |
5 | ||
6 | [ Upstream commit bc87a0036826a37b43489b029af8143bd07c6cca ] | |
7 | ||
8 | Previously, a false positive would be caught if the TIRs list is | |
9 | empty, since the err value was initialized to -ENOMEM, and was only | |
10 | updated if a TIR is refreshed. This is resolved by initializing the | |
11 | err value to zero. | |
12 | ||
13 | Fixes: b676f653896a ("net/mlx5e: Refactor refresh TIRs") | |
14 | Signed-off-by: Gavi Teitz <gavi@mellanox.com> | |
15 | Reviewed-by: Roi Dayan <roid@mellanox.com> | |
16 | Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> | |
17 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
18 | --- | |
19 | drivers/net/ethernet/mellanox/mlx5/core/en_common.c | 6 ++++-- | |
20 | 1 file changed, 4 insertions(+), 2 deletions(-) | |
21 | ||
22 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c | |
23 | index db3278cc052b..1e28866e3924 100644 | |
24 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c | |
25 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c | |
26 | @@ -141,15 +141,17 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) | |
27 | { | |
28 | struct mlx5_core_dev *mdev = priv->mdev; | |
29 | struct mlx5e_tir *tir; | |
30 | - int err = -ENOMEM; | |
31 | + int err = 0; | |
32 | u32 tirn = 0; | |
33 | int inlen; | |
34 | void *in; | |
35 | ||
36 | inlen = MLX5_ST_SZ_BYTES(modify_tir_in); | |
37 | in = kvzalloc(inlen, GFP_KERNEL); | |
38 | - if (!in) | |
39 | + if (!in) { | |
40 | + err = -ENOMEM; | |
41 | goto out; | |
42 | + } | |
43 | ||
44 | if (enable_uc_lb) | |
45 | MLX5_SET(modify_tir_in, in, ctx.self_lb_block, | |
46 | -- | |
47 | 2.19.1 | |
48 |