All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: ensure cq_entries is at least equal to or greater than sq_entries
@ 2019-10-23  1:57 Jackie Liu
  2019-10-23 18:42 ` Jeff Moyer
  0 siblings, 1 reply; 5+ messages in thread
From: Jackie Liu @ 2019-10-23  1:57 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, liuyun01

If cq_entries is smaller than sq_entries, it will cause a lot of overflow
to appear. when customizing cq_entries, at least let him be no smaller than
sq_entries.

Fixes: 95d8765bd9f2 ("io_uring: allow application controlled CQ ring size")
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index b64cd2c..dfa9731 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3784,7 +3784,7 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p)
 		 * to a power-of-two, if it isn't already. We do NOT impose
 		 * any cq vs sq ring sizing.
 		 */
-		if (!p->cq_entries || p->cq_entries > IORING_MAX_CQ_ENTRIES)
+		if (p->cq_entries < p->sq_entries || p->cq_entries > IORING_MAX_CQ_ENTRIES)
 			return -EINVAL;
 		p->cq_entries = roundup_pow_of_two(p->cq_entries);
 	} else {
-- 
2.7.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-24  3:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  1:57 [PATCH] io_uring: ensure cq_entries is at least equal to or greater than sq_entries Jackie Liu
2019-10-23 18:42 ` Jeff Moyer
2019-10-23 19:41   ` Jens Axboe
2019-10-24  0:22     ` Jackie Liu
2019-10-24  3:26       ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.