Skip to contentSkip to conversation

IB/rdmavt: Fix error unwind path for qp_priv_init() in rvt_create_qp()

PATCH Applied Serhat Kumral 3 participants 3 messages Oct 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/rdmavt: Fix error unwind path for qp_priv_init() in rvt_create_qp()

If driver_f.qp_priv_init() fails, execution jumps to bail_rq_wq, which bypasses bail_qpn. Because alloc_qpn() has already succeeded at this point, the allocated QP number is left unreleased.

Jump to bail_qpn instead to ensure the QPN is properly freed via rvt_free_qpn().

Fixes 5190f052a3654 ("IB/hfi1: Allow the driver to initialize QP priv struct")
Assisted-by LLM

---
found while investigating smatch warning:
- drivers/infiniband/sw/rdmavt/qp.c:1182 rvt_create_qp() warn: missing unwind goto?

 drivers/infiniband/sw/rdmavt/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +1 -1
index d8ee485c49a6..3602b9ff2196 100644
@@ -1173,7 +1173,7 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
 		if (rdi->driver_f.qp_priv_init) {
 			ret = rdi->driver_f.qp_priv_init(rdi, qp, init_attr);
 			if (ret)
-				goto bail_rq_wq;
+				goto bail_qpn;
 		}
 		break;
 
Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines

If driver_f.qp_priv_init() fails, execution jumps to bail_rq_wq, which bypasses bail_qpn. Because alloc_qpn() has already succeeded at this point, the allocated QP number is left unreleased.

Jump to bail_qpn instead to ensure the QPN is properly freed via rvt_free_qpn().

Fixes 5190f052a3654 ("IB/hfi1: Allow the driver to initialize QP priv struct")
Assisted-by LLM

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Serhat Kumral
Quoted 8 lines · Serhat Kumral

If driver_f.qp_priv_init() fails, execution jumps to bail_rq_wq, which bypasses bail_qpn. Because alloc_qpn() has already succeeded at this point, the allocated QP number is left unreleased.

Jump to bail_qpn instead to ensure the QPN is properly freed via rvt_free_qpn().

[...]

Applied, thanks!

[1/1] IB/rdmavt: Fix error unwind path for qp_priv_init() in rvt_create_qp()

      https://git.kernel.org/rdma/rdma/c/dd36137b218ad6

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>