0012-IB-core-Don-t-enforce-PKey-security-on-SMI-MADs.patch 1.7 KB

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