Skip to contentSkip to conversation

io_uring/waitid: always prune wait queue entry in io_waitid_wait()

PATCH New Jens Axboe 1 participant 1 message Oct 7, 2025 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/waitid: always prune wait queue entry in io_waitid_wait()

For a successful return, always remove our entry from the wait queue entry list. Previously this was skipped if a cancelation was in progress, but this can race with another invocation of the wait queue entry callback.

Fixes f31ecf671ddc ("io_uring: add IORING_OP_WAITID support")
Reported-by [email protected]

---

io_uring/waitid.c +2 -1
index 26c118f3918d..f25110fb1b12 100644
@@ -230,13 +230,14 @@ static int io_waitid_wait(struct wait_queue_entry *wait, unsigned mode,
 	if (!pid_child_should_wake(wo, p))
 		return 0;
 
+	list_del_init(&wait->entry);
+
 	/* cancel is in progress */
 	if (atomic_fetch_inc(&iw->refs) & IO_WAITID_REF_MASK)
 		return 1;
 
 	req->io_task_work.func = io_waitid_cb;
 	io_req_task_work_add(req);
-	list_del_init(&wait->entry);
 	return 1;
 }
 
Signature · 1 line
Jens Axboe