mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
io_uring: check for user passing 0 nr_submit
io_submit_sqes() shouldn't be stepping into its main loop when there is nothing to submit, i.e. nr=0. Fix 0 submission queue entries checks, which should follow after all user input truncations. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
1cba30bf9f
commit
dde92a5026
@@ -2453,10 +2453,11 @@ int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr)
|
||||
unsigned int left;
|
||||
int ret;
|
||||
|
||||
entries = min(nr, entries);
|
||||
if (unlikely(!entries))
|
||||
return 0;
|
||||
/* make sure SQ entry isn't read before tail */
|
||||
ret = left = min(nr, entries);
|
||||
|
||||
ret = left = entries;
|
||||
io_get_task_refs(left);
|
||||
io_submit_state_start(&ctx->submit_state, left);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user