]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0008-IB-core-Don-t-enforce-PKey-security-on-SMI-MADs.patch
rebase patches on top of Ubuntu-4.13.0-45.50
[pve-kernel.git] / patches / kernel / 0008-IB-core-Don-t-enforce-PKey-security-on-SMI-MADs.patch
CommitLineData
59d5af67 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
905722fb
FG
2From: Daniel Jurgens <danielj@mellanox.com>
3Date: Mon, 20 Nov 2017 16:47:45 -0600
59d5af67 4Subject: [PATCH] IB/core: Don't enforce PKey security on SMI MADs
905722fb
FG
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Per the infiniband spec an SMI MAD can have any PKey. Checking the pkey
10on SMI MADs is not necessary, and it seems that some older adapters
11using the mthca driver don't follow the convention of using the default
12PKey, resulting in false denials, or errors querying the PKey cache.
13
14SMI MAD security is still enforced, only agents allowed to manage the
15subnet are able to receive or send SMI MADs.
16
17Reported-by: Chris Blake <chrisrblake93@gmail.com>
18Fixes: 47a2b338fe63("IB/core: Enforce security on management datagrams")
19Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
20Reviewed-by: Parav Pandit <parav@mellanox.com>
21Signed-off-by: Leon Romanovsky <leon@kernel.org>
22Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
23---
24 drivers/infiniband/core/security.c | 7 +++++--
25 1 file changed, 5 insertions(+), 2 deletions(-)
26
27diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
28index 70ad19c4c73e..8f9fd3b757db 100644
29--- a/drivers/infiniband/core/security.c
30+++ b/drivers/infiniband/core/security.c
31@@ -692,8 +692,11 @@ int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)
32 {
33 int ret;
34
35- if (map->agent.qp->qp_type == IB_QPT_SMI && !map->agent.smp_allowed)
36- return -EACCES;
37+ if (map->agent.qp->qp_type == IB_QPT_SMI) {
38+ if (!map->agent.smp_allowed)
39+ return -EACCES;
40+ return 0;
41+ }
42
43 ret = ib_security_pkey_access(map->agent.device,
44 map->agent.port_num,