]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/efa: Fix possible deadlock
authorEthan Tidmore <ethantidmore06@gmail.com>
Sat, 14 Mar 2026 04:57:30 +0000 (23:57 -0500)
committerLeon Romanovsky <leonro@nvidia.com>
Tue, 17 Mar 2026 19:01:05 +0000 (15:01 -0400)
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: ef3b06742c8a2 ("RDMA/efa: Fix use of completion ctx after free")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Link: https://patch.msgid.link/20260314045730.1143862-1-ethantidmore06@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/efa/efa_com.c

index 56caba612139fc7f7973a7436023f8534bb6cf27..e97b5f0d700388bf577afd5fd3ee4e6a82a944c2 100644 (file)
@@ -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;
        }