* [PATCH] io_uring: bump poll refs to full 31-bits
@ 2022-03-22 13:00 Jens Axboe
0 siblings, 0 replies; only message in thread
From: Jens Axboe @ 2022-03-22 13:00 UTC (permalink / raw)
To: io-uring
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 <[email protected]>
---
diff --git a/fs/io_uring.c b/fs/io_uring.c
index c1a03ba0a3cf..15c4c60decd3 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5798,7 +5798,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
--
Jens Axboe
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-22 13:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-22 13:00 [PATCH] io_uring: bump poll refs to full 31-bits Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox