Commit 0f2055db authored by Ethan Tidmore's avatar Ethan Tidmore Committed by Leon Romanovsky
Browse files

RDMA/efa: Fix possible deadlock



In the error path for efa_com_alloc_comp_ctx() the semaphore assigned to
&aq->avail_cmds is not released.

Detected by Smatch:
drivers/infiniband/hw/efa/efa_com.c:662 efa_com_cmd_exec() warn:
inconsistent returns '&aq->avail_cmds'

Add release for &aq->avail_cmds in efa_com_alloc_comp_ctx() error path.

Fixes: ef3b0674 ("RDMA/efa: Fix use of completion ctx after free")
Signed-off-by: default avatarEthan Tidmore <ethantidmore06@gmail.com>
Link: https://patch.msgid.link/20260314045730.1143862-1-ethantidmore06@gmail.com


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent f28599f3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -629,6 +629,7 @@ int efa_com_cmd_exec(struct efa_com_admin_queue *aq,
	comp_ctx = efa_com_alloc_comp_ctx(aq);
	if (!comp_ctx) {
		clear_bit(EFA_AQ_STATE_RUNNING_BIT, &aq->state);
		up(&aq->avail_cmds);
		return -EINVAL;
	}