]> www.infradead.org Git - users/hch/misc.git/commitdiff
io_uring/kbuf: reject zero sized provided buffers
authorJens Axboe <axboe@kernel.dk>
Mon, 7 Apr 2025 13:51:23 +0000 (07:51 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 7 Apr 2025 13:51:23 +0000 (07:51 -0600)
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>
io_uring/kbuf.c

index 0981092596713826f6b897b10c81c4f7fb7e5eee..953d5e74256916875e3497153fbc9a57ab958c41 100644 (file)
@@ -504,6 +504,8 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
        p->nbufs = tmp;
        p->addr = READ_ONCE(sqe->addr);
        p->len = READ_ONCE(sqe->len);
+       if (!p->len)
+               return -EINVAL;
 
        if (check_mul_overflow((unsigned long)p->len, (unsigned long)p->nbufs,
                                &size))