Skip to content

Commit cf96072

Browse files
committed
io_uring/kbuf: reject zero sized provided buffers
This isn't fixing a real issue, but there's also zero point in going through group and buffer setup, when the buffers are going to be rejected once attempted to get used. Cc: [email protected] Reported-by: [email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 5a17131 commit cf96072

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: io_uring/kbuf.c

+2
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
504504
p->nbufs = tmp;
505505
p->addr = READ_ONCE(sqe->addr);
506506
p->len = READ_ONCE(sqe->len);
507+
if (!p->len)
508+
return -EINVAL;
507509

508510
if (check_mul_overflow((unsigned long)p->len, (unsigned long)p->nbufs,
509511
&size))

0 commit comments

Comments
 (0)