mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
RDMA/irdma: Initialize cqp_cmds_info to prevent resource leaks
Failure to initialize info.create field to false in certain cases was resulting in incorrect status code going to rdma-core when dereg_mr failed during reset. To fix this, memset entire cqp_request->info in irdma_alloc_and_get_cqp_request() function, so that this is not spread all over the code. Signed-off-by: Bhat, Jay <jay.bhat@intel.com> Reviewed-by: Jacob Moroni <jmoroni@google.com> Signed-off-by: Krzysztof Czurylo <krzysztof.czurylo@intel.com> Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com> Link: https://patch.msgid.link/20251031021726.1003-2-tatyana.e.nikolova@intel.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
69e8e429bc
commit
153243086e
|
|
@ -2365,7 +2365,6 @@ static int irdma_cqp_manage_apbvt_cmd(struct irdma_device *iwdev,
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
info = &cqp_info->in.u.manage_apbvt_entry.info;
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->add = add_port;
|
||||
info->port = accel_local_port;
|
||||
cqp_info->cqp_cmd = IRDMA_OP_MANAGE_APBVT_ENTRY;
|
||||
|
|
@ -2474,7 +2473,6 @@ void irdma_manage_arp_cache(struct irdma_pci_f *rf,
|
|||
if (action == IRDMA_ARP_ADD) {
|
||||
cqp_info->cqp_cmd = IRDMA_OP_ADD_ARP_CACHE_ENTRY;
|
||||
info = &cqp_info->in.u.add_arp_cache_entry.info;
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->arp_index = (u16)arp_index;
|
||||
info->permanent = true;
|
||||
ether_addr_copy(info->mac_addr, mac_addr);
|
||||
|
|
@ -2533,7 +2531,6 @@ int irdma_manage_qhash(struct irdma_device *iwdev, struct irdma_cm_info *cminfo,
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
info = &cqp_info->in.u.manage_qhash_table_entry.info;
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->vsi = &iwdev->vsi;
|
||||
info->manage = mtype;
|
||||
info->entry_type = etype;
|
||||
|
|
|
|||
|
|
@ -452,6 +452,7 @@ struct irdma_cqp_request *irdma_alloc_and_get_cqp_request(struct irdma_cqp *cqp,
|
|||
cqp_request->waiting = wait;
|
||||
refcount_set(&cqp_request->refcnt, 1);
|
||||
memset(&cqp_request->compl_info, 0, sizeof(cqp_request->compl_info));
|
||||
memset(&cqp_request->info, 0, sizeof(cqp_request->info));
|
||||
|
||||
return cqp_request;
|
||||
}
|
||||
|
|
@ -1068,7 +1069,6 @@ int irdma_cqp_qp_create_cmd(struct irdma_sc_dev *dev, struct irdma_sc_qp *qp)
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
qp_info = &cqp_request->info.in.u.qp_create.info;
|
||||
memset(qp_info, 0, sizeof(*qp_info));
|
||||
qp_info->cq_num_valid = true;
|
||||
qp_info->next_iwarp_state = IRDMA_QP_STATE_RTS;
|
||||
cqp_info->cqp_cmd = IRDMA_OP_QP_CREATE;
|
||||
|
|
@ -1343,7 +1343,6 @@ int irdma_cqp_qp_destroy_cmd(struct irdma_sc_dev *dev, struct irdma_sc_qp *qp)
|
|||
return -ENOMEM;
|
||||
|
||||
cqp_info = &cqp_request->info;
|
||||
memset(cqp_info, 0, sizeof(*cqp_info));
|
||||
cqp_info->cqp_cmd = IRDMA_OP_QP_DESTROY;
|
||||
cqp_info->post_sq = 1;
|
||||
cqp_info->in.u.qp_destroy.qp = qp;
|
||||
|
|
@ -1749,7 +1748,6 @@ int irdma_cqp_gather_stats_cmd(struct irdma_sc_dev *dev,
|
|||
return -ENOMEM;
|
||||
|
||||
cqp_info = &cqp_request->info;
|
||||
memset(cqp_info, 0, sizeof(*cqp_info));
|
||||
cqp_info->cqp_cmd = IRDMA_OP_STATS_GATHER;
|
||||
cqp_info->post_sq = 1;
|
||||
cqp_info->in.u.stats_gather.info = pestat->gather_info;
|
||||
|
|
@ -1789,7 +1787,6 @@ int irdma_cqp_stats_inst_cmd(struct irdma_sc_vsi *vsi, u8 cmd,
|
|||
return -ENOMEM;
|
||||
|
||||
cqp_info = &cqp_request->info;
|
||||
memset(cqp_info, 0, sizeof(*cqp_info));
|
||||
cqp_info->cqp_cmd = cmd;
|
||||
cqp_info->post_sq = 1;
|
||||
cqp_info->in.u.stats_manage.info = *stats_info;
|
||||
|
|
@ -1890,7 +1887,6 @@ int irdma_cqp_ws_node_cmd(struct irdma_sc_dev *dev, u8 cmd,
|
|||
return -ENOMEM;
|
||||
|
||||
cqp_info = &cqp_request->info;
|
||||
memset(cqp_info, 0, sizeof(*cqp_info));
|
||||
cqp_info->cqp_cmd = cmd;
|
||||
cqp_info->post_sq = 1;
|
||||
cqp_info->in.u.ws_node.info = *node_info;
|
||||
|
|
|
|||
|
|
@ -771,7 +771,6 @@ static int irdma_cqp_create_qp_cmd(struct irdma_qp *iwqp)
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
qp_info = &cqp_request->info.in.u.qp_create.info;
|
||||
memset(qp_info, 0, sizeof(*qp_info));
|
||||
qp_info->mac_valid = true;
|
||||
qp_info->cq_num_valid = true;
|
||||
qp_info->next_iwarp_state = IRDMA_QP_STATE_IDLE;
|
||||
|
|
@ -3102,7 +3101,6 @@ static int irdma_hw_alloc_stag(struct irdma_device *iwdev,
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
info = &cqp_info->in.u.alloc_stag.info;
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->page_size = PAGE_SIZE;
|
||||
info->stag_idx = iwmr->stag >> IRDMA_CQPSQ_STAG_IDX_S;
|
||||
info->pd_id = iwpd->sc_pd.pd_id;
|
||||
|
|
@ -3252,7 +3250,6 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr,
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
stag_info = &cqp_info->in.u.mr_reg_non_shared.info;
|
||||
memset(stag_info, 0, sizeof(*stag_info));
|
||||
stag_info->va = iwpbl->user_base;
|
||||
stag_info->stag_idx = iwmr->stag >> IRDMA_CQPSQ_STAG_IDX_S;
|
||||
stag_info->stag_key = (u8)iwmr->stag;
|
||||
|
|
@ -3646,7 +3643,6 @@ static int irdma_hwdereg_mr(struct ib_mr *ib_mr)
|
|||
|
||||
cqp_info = &cqp_request->info;
|
||||
info = &cqp_info->in.u.dealloc_stag.info;
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->pd_id = iwpd->sc_pd.pd_id;
|
||||
info->stag_idx = ib_mr->rkey >> IRDMA_CQPSQ_STAG_IDX_S;
|
||||
info->mr = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user