aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Jurgens <danielj@mellanox.com>2017-12-05 15:30:02 -0500
committerDoug Ledford <dledford@redhat.com>2017-12-07 15:28:06 -0500
commit0fbe8f575b15585eec3326e43708fbbc024e8486 (patch)
tree23d4180b82f69452cfe13f2d3c7ddb7d339975a4
parent4cae8ff136782d77b108cb3a5ba53e60597ba3a6 (diff)
IB/core: Don't enforce PKey security on SMI MADs
Per the infiniband spec an SMI MAD can have any PKey. Checking the pkey on SMI MADs is not necessary, and it seems that some older adapters using the mthca driver don't follow the convention of using the default PKey, resulting in false denials, or errors querying the PKey cache. SMI MAD security is still enforced, only agents allowed to manage the subnet are able to receive or send SMI MADs. Reported-by: Chris Blake <chrisrblake93@gmail.com> Cc: <stable@vger.kernel.org> # v4.12 Fixes: 47a2b338fe63 ("IB/core: Enforce security on management datagrams") Signed-off-by: Daniel Jurgens <danielj@mellanox.com> Reviewed-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/security.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
index a337386652b0..feafdb961c48 100644
--- a/drivers/infiniband/core/security.c
+++ b/drivers/infiniband/core/security.c
@@ -739,8 +739,11 @@ int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)
739 if (!rdma_protocol_ib(map->agent.device, map->agent.port_num)) 739 if (!rdma_protocol_ib(map->agent.device, map->agent.port_num))
740 return 0; 740 return 0;
741 741
742 if (map->agent.qp->qp_type == IB_QPT_SMI && !map->agent.smp_allowed) 742 if (map->agent.qp->qp_type == IB_QPT_SMI) {
743 return -EACCES; 743 if (!map->agent.smp_allowed)
744 return -EACCES;
745 return 0;
746 }
744 747
745 return ib_security_pkey_access(map->agent.device, 748 return ib_security_pkey_access(map->agent.device,
746 map->agent.port_num, 749 map->agent.port_num,