]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.112/net-mlx5e-fix-error-handling-when-refreshing-tirs.patch
Linux 4.9.169
[thirdparty/kernel/stable-queue.git] / releases / 4.14.112 / net-mlx5e-fix-error-handling-when-refreshing-tirs.patch
1 From foo@baz Mon Apr 15 07:47:06 CEST 2019
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 From: Gavi Teitz <gavi@mellanox.com>
7
8 [ Upstream commit bc87a0036826a37b43489b029af8143bd07c6cca ]
9
10 Previously, a false positive would be caught if the TIRs list is
11 empty, since the err value was initialized to -ENOMEM, and was only
12 updated if a TIR is refreshed. This is resolved by initializing the
13 err value to zero.
14
15 Fixes: b676f653896a ("net/mlx5e: Refactor refresh TIRs")
16 Signed-off-by: Gavi Teitz <gavi@mellanox.com>
17 Reviewed-by: Roi Dayan <roid@mellanox.com>
18 Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 drivers/net/ethernet/mellanox/mlx5/core/en_common.c | 6 ++++--
22 1 file changed, 4 insertions(+), 2 deletions(-)
23
24 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
25 +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
26 @@ -140,15 +140,17 @@ int mlx5e_refresh_tirs(struct mlx5e_priv
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,