diff mbox series

[v3,1/1] io_uring: check for iowq alloc_workqueue failure

Message ID 3a046063902f888f66151f89fa42f84063b9727b.1738343083.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series [v3,1/1] io_uring: check for iowq alloc_workqueue failure | expand

Commit Message

Pavel Begunkov Jan. 31, 2025, 5:28 p.m. UTC
alloc_workqueue() can fail even during init in io_uring_init(), check
the result and panic if anything went wrong.

Fixes: 73eaa2b583493 ("io_uring: use private workqueue for exit work")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---

v3: BUG_ON() since it seems nobody checks errors
v2: drop kmem_cache checking

 io_uring/io_uring.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jens Axboe Jan. 31, 2025, 11:56 p.m. UTC | #1
On Fri, 31 Jan 2025 17:28:21 +0000, Pavel Begunkov wrote:
> alloc_workqueue() can fail even during init in io_uring_init(), check
> the result and panic if anything went wrong.
> 
> 

Applied, thanks!

[1/1] io_uring: check for iowq alloc_workqueue failure
      commit: 74c726467895a435b89149204ba0c8b245ba9bb7

Best regards,
diff mbox series

Patch

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 263e504be4a8b..dfebd949b8f37 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3920,6 +3920,7 @@  static int __init io_uring_init(void)
 					  SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
 
 	iou_wq = alloc_workqueue("iou_exit", WQ_UNBOUND, 64);
+	BUG_ON(!iou_wq);
 
 #ifdef CONFIG_SYSCTL
 	register_sysctl_init("kernel", kernel_io_uring_disabled_table);