Skip to contentSkip to conversation

io_uring/kbuf: reject zero sized provided buffers

PATCH New Jens Axboe 1 participant 1 message Apr 7, 2025 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 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.

---

io_uring/kbuf.c +2 -0
index 098109259671..953d5e742569 100644
@@ -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))
Signature · 1 line
Jens Axboe