IB/rdmavt: Fix error unwind path for qp_priv_init() in rvt_create_qp()
Subsystems (2)
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().
---
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
@@ -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
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
If
driver_f.qp_priv_init()fails, execution jumps tobail_rq_wq, which bypassesbail_qpn. Becausealloc_qpn()has already succeeded at this point, the allocated QP number is left unreleased.Jump to
bail_qpninstead to ensure the QPN is properly freed viarvt_free_qpn().Fixes 5190f052a3654 ("IB/hfi1: Allow the driver to initialize QP priv struct")Assisted-by LLMSigned-off-by Serhat Kumral <[email protected]>
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
Leon Romanovsky
AppliedQuoted 8 lines · Serhat Kumral
If
driver_f.qp_priv_init()fails, execution jumps tobail_rq_wq, which bypassesbail_qpn. Becausealloc_qpn()has already succeeded at this point, the allocated QP number is left unreleased.Jump to
bail_qpninstead to ensure the QPN is properly freed viarvt_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]>