VYPR
Unrated severityNVD Advisory· Published May 28, 2026

CVE-2026-46126

CVE-2026-46126

Description

In the Linux kernel, the following vulnerability has been resolved:

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

Sashiko points out there are two bugs here in the error unwind flow, both related to how the WQ table is unwound.

First there is a double i-- on the first failure path due to the while loop having a i--, remove it.

Second if mana_ib_install_cq_cb() fails then mana_create_wq_obj() is not undone due to the above i--.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Double decrement and missing cleanup in error path of mana_ib_create_qp_rss() in Linux kernel's RDMA/mana driver.

Vulnerability

In the Linux kernel’s RDMA/mana driver, the function mana_ib_create_qp_rss() contains two bugs in its error unwinding path for the WQ table. The first bug is a double i-- due to a while loop that already decrements i, causing an extra decrement. The second bug occurs when mana_ib_install_cq_cb() fails: the previously created WQ object via mana_create_wq_obj() is not undone because of the aforementioned double i--. This affects versions up to the commit fix, typically kernels in development (since it is CVE-2026, still future). [1]

Exploitation

To trigger this, an attacker would need to be able to create a QP with RSS on a Mana device. This requires local access with sufficient privileges (e.g., root or CAP_NET_ADMIN) and the ability to trigger an error condition during QP creation, such as by causing a failure in mana_ib_install_cq_cb(). The exploit sequence involves initiating a QP creation and ensuring the error path is taken, possibly by exhausting resources or causing a specific failure.

Impact

On exploitation, the driver may leak resources or cause a use-after-free due to incorrect cleanup. This could lead to system instability or denial of service. The impact is primarily availability (DoS) but could potentially lead to information disclosure or privilege escalation in some scenarios, though not explicitly stated.

Mitigation

The fix is available in the Linux kernel repository as commit 8f23eb6c50f1a4bf32fc4d62cfb9fc39e8e586cf. Users should update their kernel to include this patch. The exact release version is not yet known; administrators should monitor kernel updates and apply the patch as soon as it is backported to their distribution. No known workarounds exist.

AI Insight generated on May 28, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

1

Patches

8
34ecf795692e

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJason GunthorpeApr 28, 2026Fixed in 7.1-rc3via kernel-cna
2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index f7bb0d1f0f8034..8e1f052d0ec976 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -176,11 +176,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -200,8 +197,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index f7bb0d1f0f8034..8e1f052d0ec976 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -176,11 +176,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -200,8 +197,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
bb9cb36eaefa

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJason GunthorpeApr 28, 2026Fixed in 6.18.30via kernel-cna
2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index d688395b44982c..67177d92f11a10 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index d688395b44982c..67177d92f11a10 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
9a05a6798177

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJason GunthorpeApr 28, 2026Fixed in 7.0.7via kernel-cna
2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index 8af29061febe20..bb1737176e2b42 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -193,11 +193,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -217,8 +214,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index 8af29061febe20..bb1737176e2b42 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -193,11 +193,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -217,8 +214,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
8f23eb6c50f1

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJason GunthorpeApr 28, 2026Fixed in 6.12.88via kernel-cna
2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index e6375064f14d7a..2741eec6f26fad 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index e6375064f14d7a..2741eec6f26fad 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
34ecf795692e

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index f7bb0d1f0f8034..8e1f052d0ec976 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -176,11 +176,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -200,8 +197,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index f7bb0d1f0f8034..8e1f052d0ec976 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -176,11 +176,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -200,8 +197,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
8f23eb6c50f1

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index e6375064f14d7a..2741eec6f26fad 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index e6375064f14d7a..2741eec6f26fad 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
9a05a6798177

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index 8af29061febe20..bb1737176e2b42 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -193,11 +193,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -217,8 +214,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index 8af29061febe20..bb1737176e2b42 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -193,11 +193,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -217,8 +214,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
bb9cb36eaefa

RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()

2 files changed · +8 12
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index d688395b44982c..67177d92f11a10 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/infiniband/hw/mana/qp.c+4 6 modified
    diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
    index d688395b44982c..67177d92f11a10 100644
    --- a/drivers/infiniband/hw/mana/qp.c
    +++ b/drivers/infiniband/hw/mana/qp.c
    @@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
     					 &wq_spec, &cq_spec, &wq->rx_object);
    -		if (ret) {
    -			/* Do cleanup starting with index i-1 */
    -			i--;
    +		if (ret)
     			goto fail;
    -		}
     
     		/* The GDMA regions are now owned by the WQ object */
     		wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
    @@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
     
     		/* Create CQ table entry */
     		ret = mana_ib_install_cq_cb(mdev, cq);
    -		if (ret)
    +		if (ret) {
    +			mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
     			goto fail;
    +		}
     	}
     	resp.num_entries = i;
     
    -- 
    cgit 1.3-korg
    
    
    

Vulnerability mechanics

Root cause

"Incorrect error-unwind logic in mana_ib_create_qp_rss() causes a double decrement of the loop counter and a missing mana_destroy_wq_obj() call, leaking WQ objects."

Attack vector

An attacker who can trigger the creation of an RSS queue pair (QP) on a Microsoft Azure MANA RDMA device can cause the kernel to leak WQ objects. When `mana_create_wq_obj()` succeeds but the subsequent `mana_ib_install_cq_cb()` fails, the old code jumped to `fail` without calling `mana_destroy_wq_obj()`, leaving the WQ object allocated. Additionally, the redundant `i--` on the `mana_create_wq_obj()` failure path caused the loop to skip cleaning up the correct WQ entry, leading to further resource leaks. No special privileges beyond the ability to create an RDMA QP are required.

Affected code

The bug is in `drivers/infiniband/hw/mana/qp.c` in the `mana_ib_create_qp_rss()` function. The error-unwind logic inside the loop that creates WQ objects and installs CQ callbacks has two defects: a redundant `i--` that causes a double decrement, and a missing `mana_destroy_wq_obj()` call when `mana_ib_install_cq_cb()` fails [patch_id=2898478].

What the fix does

The patch makes two changes in `mana_ib_create_qp_rss()` [patch_id=2898478]. First, it removes the extra `i--` inside the `if (ret)` block after `mana_create_wq_obj()`, so the loop counter is no longer double-decremented. Second, when `mana_ib_install_cq_cb()` fails, the patch adds an explicit `mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object)` call before jumping to `fail`, ensuring the previously created WQ object is properly freed. Both changes correct the error-unwind logic so that all allocated resources are released on failure.

Preconditions

  • authThe attacker must be able to create an RSS queue pair on a MANA RDMA device.
  • configThe system must have the `mana_ib` driver loaded and a MANA device present.

Generated on May 28, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

4

News mentions

0

No linked articles in our index yet.