From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F7FB284881 for ; Fri, 20 Mar 2026 17:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774028051; cv=none; b=qdV+Bo1ZP5Cy+t2TUQxmh9EIrdAgC/u/VMKCeNWZhsua+S5cZJfZ2z5/tZ2e7zncWr6MWy2QJ1H+Xb7jwX78vxwha0dXb6c94lRsHjFX0cgku50SweyGaPCkttVgZh5g/OOFqv4AuRCyGvqv8iWCZefNnnzLOE3KATIVHdIK6W4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774028051; c=relaxed/simple; bh=k9sVyl0V4rwjvYgL2hflL/Od2TbcxltXXa6gsC38hn4=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=QrMPbMgK6dtirPkZQSxepbaEauXbEhNK///B2kwekKHMJUBt6Zh9Fv+luiDgec9OHdJoOdgH2s8iqlZbUtPSxMhABkZYe97QKJhmU778B2DjbReAZgKEVYNEjYKQqHO+qgEhY4eI9+ZNmqsLk3XG2jJimH4Jx2ya+jCsAvhY3dg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pGowbW3z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pGowbW3z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DE98C4CEF7; Fri, 20 Mar 2026 17:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774028051; bh=k9sVyl0V4rwjvYgL2hflL/Od2TbcxltXXa6gsC38hn4=; h=Subject:To:Cc:From:Date:From; b=pGowbW3zOUYvdsk4PbKqstA0t+3RRlSgNjtGNXWewzoSxw7RPUkc5anTb6+8WVqiJ s/iZ+vG3IixehvCJX1jg193g5fxvtmBquMbo48FCN6+a7ADr7XGOwbkG03oAnYcrfX lxWal/KZhjxVFkwmRxWYzLG0NS7gFfgbpp7xWC2U= Subject: FAILED: patch "[PATCH] io_uring/poll: fix multishot recv missing EOF on wakeup race" failed to apply to 6.1-stable tree To: axboe@kernel.dk,francis@malagauche.com Cc: From: Date: Fri, 20 Mar 2026 18:33:57 +0100 Message-ID: <2026032057-septic-boogeyman-daef@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x a68ed2df72131447d131531a08fe4dfcf4fa4653 # git commit -s git send-email --to '' --in-reply-to '2026032057-septic-boogeyman-daef@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From a68ed2df72131447d131531a08fe4dfcf4fa4653 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 15 Mar 2026 09:03:03 -0600 Subject: [PATCH] io_uring/poll: fix multishot recv missing EOF on wakeup race When a socket send and shutdown() happen back-to-back, both fire wake-ups before the receiver's task_work has a chance to run. The first wake gets poll ownership (poll_refs=1), and the second bumps it to 2. When io_poll_check_events() runs, it calls io_poll_issue() which does a recv that reads the data and returns IOU_RETRY. The loop then drains all accumulated refs (atomic_sub_return(2) -> 0) and exits, even though only the first event was consumed. Since the shutdown is a persistent state change, no further wakeups will happen, and the multishot recv can hang forever. Check specifically for HUP in the poll loop, and ensure that another loop is done to check for status if more than a single poll activation is pending. This ensures we don't lose the shutdown event. Cc: stable@vger.kernel.org Fixes: dbc2564cfe0f ("io_uring: let fast poll support multishot") Reported-by: Francis Brosseau Link: https://github.com/axboe/liburing/issues/1549 Signed-off-by: Jens Axboe diff --git a/io_uring/poll.c b/io_uring/poll.c index aac4b3b881fb..488c08593b64 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -272,6 +272,7 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw) atomic_andnot(IO_POLL_RETRY_FLAG, &req->poll_refs); v &= ~IO_POLL_RETRY_FLAG; } + v &= IO_POLL_REF_MASK; } /* the mask was stashed in __io_poll_execute */ @@ -304,8 +305,13 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw) return IOU_POLL_REMOVE_POLL_USE_RES; } } else { - int ret = io_poll_issue(req, tw); + int ret; + /* multiple refs and HUP, ensure we loop once more */ + if ((req->cqe.res & (POLLHUP | POLLRDHUP)) && v != 1) + v--; + + ret = io_poll_issue(req, tw); if (ret == IOU_COMPLETE) return IOU_POLL_REMOVE_POLL_USE_RES; else if (ret == IOU_REQUEUE) @@ -321,7 +327,6 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw) * Release all references, retry if someone tried to restart * task_work while we were executing it. */ - v &= IO_POLL_REF_MASK; } while (atomic_sub_return(v, &req->poll_refs) & IO_POLL_REF_MASK); io_napi_add(req);