[PATCH rdma-core 5/7] acm: Fix incorrect TID masking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The kernel uses the upper 32 bits of the TID for the agent ID
(see drivers/infiniband/core/user_mad.c ib_umad_write)

This worked on x86 because the TID is in BE at this point and the upper
32 bit masking is correct when working with BE data.

Noticed by sparse.

Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>
---
 ibacm/src/acm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index f3512dac106815..cf107815221b14 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2770,8 +2770,8 @@ static void acmc_recv_mad(struct acmc_port *port)
 	found = 0;
 	pthread_mutex_lock(&port->lock);
 	list_for_each(&port->sa_pending, req, entry) {
-		/* The lower 32-bit of the tid is used for agentid in umad */
-		if (req->mad.sa_mad.mad_hdr.tid == (hdr->tid & 0xFFFFFFFF00000000ULL)) {
+		/* The upper 32-bit of the tid is used for agentid in umad */
+		if (req->mad.sa_mad.mad_hdr.tid == (hdr->tid & htobe64(0xFFFFFFFF))) {
 			found = 1;
 			list_del(&req->entry);
 			port->sa_credits++;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux