[PATCH rdma-rc] RDMA/cma: Zero out qp and ah attribute

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

 



From: Parav Pandit <parav@xxxxxxxxxxxx>

Commit given in fixes tag introduced an accurate check to validate
device, port, index by referring to the cache layer for querying GIDs
for all link layers (IB, RoCE and iWarp).

When rdmacm tries to modify the QP to RTR state for kernel consumers,
qp and ah attributes are uninitialized. Each transport layer (IB/iWarp)
initializes them depending on transport type.
However qp ah_attr are not used for iWarp and remained uninitialized,
which is further used in ib_query_gid() call. This results into a
failure to query the GID due to an invalid GID index coming from
the uninitialized stack memory.
This is reported and discussed in thread [1].

This fix zero out the qp and ah attributes to avoid unitialized GID
index.

[1] https://www.spinics.net/lists/linux-rdma/msg63951.html

Fixes: f35faa4ba956 ("IB/core: Simplify ib_query_gid to always refer to cache")
Tested-by: Raju Rangoju <rajur@xxxxxxxxxxx>
Signed-off-by: Parav Pandit <parav@xxxxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 8364223422d0..46b076813147 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -866,7 +866,7 @@ EXPORT_SYMBOL(rdma_destroy_qp);
 static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,
 			     struct rdma_conn_param *conn_param)
 {
-	struct ib_qp_attr qp_attr;
+	struct ib_qp_attr qp_attr = {};
 	int qp_attr_mask, ret;
 	union ib_gid sgid;
 
-- 
2.14.3

--
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