diff mbox series

[for-rc] RDMA/irdma: Initialize net_type before checking it

Message ID 20221122004410.1471-1-shiraz.saleem@intel.com (mailing list archive)
State Accepted
Headers show
Series [for-rc] RDMA/irdma: Initialize net_type before checking it | expand

Commit Message

Shiraz Saleem Nov. 22, 2022, 12:44 a.m. UTC
From: Mustafa Ismail <mustafa.ismail@intel.com>

The av->net_type is not initialized before it is checked in
irdma_modify_qp_roce. This leads to an incorrect update to the ARP cache
and QP context. RoCEv2 connections might fail as result.

Set the net_type using rdma_gid_attr_network_type.

Fixes: 80005c43d4c8 ("RDMA/irdma: Use net_type to check network type")
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
---
 drivers/infiniband/hw/irdma/verbs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Leon Romanovsky Nov. 22, 2022, 2:16 p.m. UTC | #1
On Mon, 21 Nov 2022 18:44:10 -0600, Shiraz Saleem wrote:
> From: Mustafa Ismail <mustafa.ismail@intel.com>
> 
> The av->net_type is not initialized before it is checked in
> irdma_modify_qp_roce. This leads to an incorrect update to the ARP cache
> and QP context. RoCEv2 connections might fail as result.
> 
> Set the net_type using rdma_gid_attr_network_type.
> 
> [...]

Applied, thanks!

[1/1] RDMA/irdma: Initialize net_type before checking it
      https://git.kernel.org/rdma/rdma/c/9907526d25c4ad

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index a22afbb..4da5d6f 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -1242,6 +1242,7 @@  int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		av->attrs = attr->ah_attr;
 		rdma_gid2ip((struct sockaddr *)&av->sgid_addr, &sgid_attr->gid);
 		rdma_gid2ip((struct sockaddr *)&av->dgid_addr, &attr->ah_attr.grh.dgid);
+		av->net_type = rdma_gid_attr_network_type(sgid_attr);
 		if (av->net_type == RDMA_NETWORK_IPV6) {
 			__be32 *daddr =
 				av->dgid_addr.saddr_in6.sin6_addr.in6_u.u6_addr32;