public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Soham Kute <officialsohamkute@gmail.com>
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+ab12f0c08dd7ab8d057c@syzkaller.appspotmail.com
Subject: Re: [PATCH] io_uring: fix list corruption race in io_pollfree_wake()
Date: Thu, 12 Feb 2026 05:02:56 -0700	[thread overview]
Message-ID: <ddb783d5-f69d-45da-ae76-96578ababe03@kernel.dk> (raw)
In-Reply-To: <20260212115458.9149-1-officialsohamkute@gmail.com>

On 2/12/26 4:54 AM, Soham Kute wrote:
> io_pollfree_wake() removes the poll wait entry without holding
> the waitqueue head lock. Other removal paths take the head lock,
> so this can race and lead to list corruption detected by list_debug.
> 
> Acquire the waitqueue lock before calling io_poll_remove_waitq(),
> matching the locking used in io_poll_remove_entry().
> 
> Reported-by: syzbot+ab12f0c08dd7ab8d057c@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=ab12f0c08dd7ab8d057c
> Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
> ---
>  io_uring/poll.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/io_uring/poll.c b/io_uring/poll.c
> index aac4b3b88..006154355 100644
> --- a/io_uring/poll.c
> +++ b/io_uring/poll.c
> @@ -383,10 +383,17 @@ static void io_poll_cancel_req(struct io_kiocb *req)
>  
>  static __cold int io_pollfree_wake(struct io_kiocb *req, struct io_poll *poll)
>  {
> +	struct wait_queue_head *head;
>  	io_poll_mark_cancelled(req);
>  	/* we have to kick tw in case it's not already */
>  	io_poll_execute(req, 0);
> -	io_poll_remove_waitq(poll);
> +	/* Pairs with smp_store_release() in io_poll_remove_waitq() */
> +	head = smp_load_acquire(&poll->head);
> +	if (head) {
> +		spin_lock_irq(&head->lock);
> +		io_poll_remove_waitq(poll);
> +		spin_unlock_irq(&head->lock);
> +	}
>  	return 1;
>  }

The callpath is io_poll_wake() -> io_pollfree_wake(), where the former
where much holds &head->lock already. How did you come to this
conclusion? Your patch would instantly deadlock.

Additionally, if you follow the replies off your syzbot link:

Closes: https://syzkaller.appspot.com/bug?extid=ab12f0c08dd7ab8d057c

you'll see I already debugged this issue, it's a media bug, and there's
no POLLFREE involved at all. And it looks like I'm not even the first
one to debug it, I subsequently found that someone else sent in a
different patch for this last year, but solving the same root cause in
media.

-- 
Jens Axboe

      reply	other threads:[~2026-02-12 12:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 11:54 [PATCH] io_uring: fix list corruption race in io_pollfree_wake() Soham Kute
2026-02-12 12:02 ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ddb783d5-f69d-45da-ae76-96578ababe03@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=officialsohamkute@gmail.com \
    --cc=syzbot+ab12f0c08dd7ab8d057c@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox