This is a note to let you know that I've just added the patch titled io_uring: bump poll refs to full 31-bits to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-bump-poll-refs-to-full-31-bits.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Thu Sep 1 11:59:31 AM CEST 2022 From: Pavel Begunkov <asml.silence@xxxxxxxxx> Date: Mon, 29 Aug 2022 14:30:21 +0100 Subject: io_uring: bump poll refs to full 31-bits To: stable@xxxxxxxxxxxxxxx Cc: Jens Axboe <axboe@xxxxxxxxx>, asml.silence@xxxxxxxxx Message-ID: <a043031ab97528ca7bd9aeed262bf4b3580d7ef5.1661594698.git.asml.silence@xxxxxxxxx> From: Jens Axboe <axboe@xxxxxxxxx> [ upstream commmit e2c0cb7c0cc72939b61a7efee376206725796625 ] The previous commit: 1bc84c40088 ("io_uring: remove poll entry from list when canceling all") removed a potential overflow condition for the poll references. They are currently limited to 20-bits, even if we have 31-bits available. The upper bit is used to mark for cancelation. Bump the poll ref space to 31-bits, making that kind of situation much harder to trigger in general. We'll separately add overflow checking and handling. Fixes: aa43477b0402 ("io_uring: poll rework") Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> [pavel: backport] Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5314,7 +5314,7 @@ struct io_poll_table { }; #define IO_POLL_CANCEL_FLAG BIT(31) -#define IO_POLL_REF_MASK ((1u << 20)-1) +#define IO_POLL_REF_MASK GENMASK(30, 0) /* * If refs part of ->poll_refs (see IO_POLL_REF_MASK) is 0, it's free. We can Patches currently in stable-queue which might be from asml.silence@xxxxxxxxx are queue-5.15/io_uring-fix-wrong-arm_poll-error-handling.patch queue-5.15/io_uring-poll-rework.patch queue-5.15/io_uring-remove-unused-function-req_ref_put.patch queue-5.15/io_uring-fail-links-when-poll-fails.patch queue-5.15/io_uring-inline-io_poll_complete.patch queue-5.15/io_uring-bump-poll-refs-to-full-31-bits.patch queue-5.15/io_uring-clean-cqe-filling-functions.patch queue-5.15/io_uring-fix-uaf-due-to-missing-pollfree-handling.patch queue-5.15/io_uring-correct-fill-events-helpers-types.patch queue-5.15/io_uring-refactor-poll-update.patch queue-5.15/io_uring-kill-poll-linking-optimisation.patch queue-5.15/io_uring-remove-poll-entry-from-list-when-canceling-all.patch queue-5.15/io_uring-move-common-poll-bits.patch