Skip to content

Commit

Permalink
IB/qib: Fix M_Key field in SubnGet and SubnGetResp MADs
Browse files Browse the repository at this point in the history
Set the M_Key field in SubnGet and SugnGetResp MADs based on correctly
interpreting the protection level specified in the M_KeyProtBits field.

Signed-off-by: Mitko Haralanov <mitko@qlogic.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Mitko Haralanov authored and Roland Dreier committed Mar 14, 2011
1 parent 4634b79 commit 36b87b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/infiniband/hw/qib/qib_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,9 @@ static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
memset(smp->data, 0, sizeof(smp->data));

/* Only return the mkey if the protection field allows it. */
if (smp->method == IB_MGMT_METHOD_SET || ibp->mkey == smp->mkey ||
ibp->mkeyprot == 0)
if (!(smp->method == IB_MGMT_METHOD_GET &&
ibp->mkey != smp->mkey &&
ibp->mkeyprot == 1))
pip->mkey = ibp->mkey;
pip->gid_prefix = ibp->gid_prefix;
lid = ppd->lid;
Expand Down

0 comments on commit 36b87b4

Please sign in to comment.