Skip to content

Commit 3e03568

Browse files
axboegregkh
authored andcommitted
io_uring/kbuf: reject zero sized provided buffers
commit cf96072 upstream. 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: stable@vger.kernel.org Reported-by: syzbot+58928048fd1416f1457c@syzkaller.appspotmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b7c6d08 commit 3e03568

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/kbuf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
484484
p->nbufs = tmp;
485485
p->addr = READ_ONCE(sqe->addr);
486486
p->len = READ_ONCE(sqe->len);
487+
if (!p->len)
488+
return -EINVAL;
487489

488490
if (check_mul_overflow((unsigned long)p->len, (unsigned long)p->nbufs,
489491
&size))

0 commit comments

Comments
 (0)