diff mbox series

[2/3] io_uring: propagate io_buffer creation errors

Message ID 139e48488d160a13e81b170fe0499c4b756d527b.1738339723.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series check errors in early init | expand

Commit Message

Pavel Begunkov Jan. 31, 2025, 4:24 p.m. UTC
It's very unlikely, but in theory cache creation can fail during
initcall, so don't forget to return errors back if something goes wrong.

Fixes: b3a4dbc89d402 ("io_uring/kbuf: Use slab for struct io_buffer objects")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 9335144495299..b05580c1a6424 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3921,6 +3921,8 @@  static int __init io_uring_init(void)
 
 	io_buf_cachep = KMEM_CACHE(io_buffer,
 					  SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
+	if (!io_buf_cachep)
+		return -ENOMEM;
 
 	iou_wq = alloc_workqueue("iou_exit", WQ_UNBOUND, 64);