Skip to content

Commit 696ed92

Browse files
committed
providers/efa: Fix the size check in efadv_create_cq
efadv_create_cq incorrectly uses sizeof(efa_attr) instead of sizeof(*efa_attr) to calculate the size of the efa_attr struct, as a result, the currentt inlen>sizeof(efa_attr) will always be true as the latter will be 8 bytes always. This bug breaks the backward compatibility when a library is built with an older rdma-core that has smaller efa_attr struct, but run with newer rdma-core that has larger efa_attr, as the later called `is_ext_clear` check is to make sure when application input a inlen larger than size of efa_attr, the extra space are all zero-ed, and it will fail when the inlen is smaller than the actual size of efa_attr. However when inlen is <= than size of the efa_attr struct, such is_ext_clear check shouldn't happen. Fixes: a00b600 ("efa: Introduce EFA DV CQ") Signed-off-by: Shi Jin <sjina@amazon.com>
1 parent 0d977c5 commit 696ed92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

providers/efa/verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ struct ibv_cq_ex *efadv_create_cq(struct ibv_context *ibvctx,
12851285

12861286
if (!vext_field_avail(struct efadv_cq_init_attr, wc_flags, inlen) ||
12871287
efa_attr->comp_mask ||
1288-
(inlen > sizeof(efa_attr) && !is_ext_cleared(efa_attr, inlen))) {
1288+
(inlen > sizeof(*efa_attr) && !is_ext_cleared(efa_attr, inlen))) {
12891289
verbs_err(verbs_get_ctx(ibvctx), "Compatibility issues\n");
12901290
errno = EINVAL;
12911291
return NULL;

0 commit comments

Comments
 (0)