[PATCH] io_uring: ensure cq_entries is at least equal to or greater than sq_entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux