Skip to contentSkip to conversation

RDMA/efa: Fix possible deadlock

PATCH Applied Ethan Tidmore 2 participants 3 messages Mar 14 – Mar 16

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

PATCH 1/1 RDMA/efa: Fix possible deadlock

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

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")
---
 drivers/infiniband/hw/efa/efa_com.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/efa/efa_com.c +1 -0
index 56caba612139..e97b5f0d7003 100644
@@ -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;
 	}
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 4 lines · Ethan Tidmore

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

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

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

Quoted 4 lines
Fixes ef3b06742c8a2 ("RDMA/efa: Fix use of completion ctx after free")

---

Forgot to add the Smatch warning, if this version is good please add this to the commit message.

Thanks,

ET