Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: fix invalid hybrid polling ctx leaks

It has already allocated the ctx by the point where it checks the hybrid
poll configuration, plain return leaks the memory.

Fixes: 01ee194d1aba1 ("io_uring: add support for hybrid IOPOLL")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Link: https://lore.kernel.org/r/b57f2608088020501d352fcdeebdb949e281d65b.1731468230.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
b9d69371 a43e236f

+5 -5
+5 -5
io_uring/io_uring.c
··· 3616 3616 if (!(ctx->flags & IORING_SETUP_NO_SQARRAY)) 3617 3617 static_branch_inc(&io_key_has_sqarray); 3618 3618 3619 - /* HYBRID_IOPOLL only valid with IOPOLL */ 3620 - if ((ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_HYBRID_IOPOLL)) == 3621 - IORING_SETUP_HYBRID_IOPOLL) 3622 - return -EINVAL; 3623 - 3624 3619 if ((ctx->flags & IORING_SETUP_DEFER_TASKRUN) && 3625 3620 !(ctx->flags & IORING_SETUP_IOPOLL) && 3626 3621 !(ctx->flags & IORING_SETUP_SQPOLL)) ··· 3665 3670 goto err; 3666 3671 ctx->notify_method = TWA_SIGNAL; 3667 3672 } 3673 + 3674 + /* HYBRID_IOPOLL only valid with IOPOLL */ 3675 + if ((ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_HYBRID_IOPOLL)) == 3676 + IORING_SETUP_HYBRID_IOPOLL) 3677 + goto err; 3668 3678 3669 3679 /* 3670 3680 * For DEFER_TASKRUN we require the completion task to be the same as the