]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.16.14/ib-core-fix-error-code-for-invalid-gid-entry.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.16.14 / ib-core-fix-error-code-for-invalid-gid-entry.patch
1 From a840c93ca7582bb6c88df2345a33f979b7a67874 Mon Sep 17 00:00:00 2001
2 From: Parav Pandit <parav@mellanox.com>
3 Date: Sun, 27 May 2018 14:49:16 +0300
4 Subject: IB/core: Fix error code for invalid GID entry
5
6 From: Parav Pandit <parav@mellanox.com>
7
8 commit a840c93ca7582bb6c88df2345a33f979b7a67874 upstream.
9
10 When a GID entry is invalid EAGAIN is returned. This is an incorrect error
11 code, there is nothing that will make this GID entry valid again in
12 bounded time.
13
14 Some user space tools fail incorrectly if EAGAIN is returned here, and
15 this represents a small ABI change from earlier kernels.
16
17 The first patch in the Fixes list makes entries that were valid before
18 to become invalid, allowing this code to trigger, while the second patch
19 in the Fixes list introduced the wrong EAGAIN.
20
21 Therefore revert the return result to EINVAL which matches the historical
22 expectations of the ibv_query_gid_type() API of the libibverbs user space
23 library.
24
25 Cc: <stable@vger.kernel.org>
26 Fixes: 598ff6bae689 ("IB/core: Refactor GID modify code for RoCE")
27 Fixes: 03db3a2d81e6 ("IB/core: Add RoCE GID table management")
28 Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
29 Signed-off-by: Parav Pandit <parav@mellanox.com>
30 Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
31 Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33
34 ---
35 drivers/infiniband/core/cache.c | 2 +-
36 1 file changed, 1 insertion(+), 1 deletion(-)
37
38 --- a/drivers/infiniband/core/cache.c
39 +++ b/drivers/infiniband/core/cache.c
40 @@ -434,7 +434,7 @@ static int __ib_cache_gid_get(struct ib_
41 return -EINVAL;
42
43 if (table->data_vec[index].props & GID_TABLE_ENTRY_INVALID)
44 - return -EAGAIN;
45 + return -EINVAL;
46
47 memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
48 if (attr) {