mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
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: 01ee194d1a
("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>
This commit is contained in:
parent
a43e236fb9
commit
b9d69371e8
@ -3616,11 +3616,6 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
|
|||||||
if (!(ctx->flags & IORING_SETUP_NO_SQARRAY))
|
if (!(ctx->flags & IORING_SETUP_NO_SQARRAY))
|
||||||
static_branch_inc(&io_key_has_sqarray);
|
static_branch_inc(&io_key_has_sqarray);
|
||||||
|
|
||||||
/* HYBRID_IOPOLL only valid with IOPOLL */
|
|
||||||
if ((ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_HYBRID_IOPOLL)) ==
|
|
||||||
IORING_SETUP_HYBRID_IOPOLL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if ((ctx->flags & IORING_SETUP_DEFER_TASKRUN) &&
|
if ((ctx->flags & IORING_SETUP_DEFER_TASKRUN) &&
|
||||||
!(ctx->flags & IORING_SETUP_IOPOLL) &&
|
!(ctx->flags & IORING_SETUP_IOPOLL) &&
|
||||||
!(ctx->flags & IORING_SETUP_SQPOLL))
|
!(ctx->flags & IORING_SETUP_SQPOLL))
|
||||||
@ -3671,6 +3666,11 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
|
|||||||
ctx->notify_method = TWA_SIGNAL;
|
ctx->notify_method = TWA_SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* HYBRID_IOPOLL only valid with IOPOLL */
|
||||||
|
if ((ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_HYBRID_IOPOLL)) ==
|
||||||
|
IORING_SETUP_HYBRID_IOPOLL)
|
||||||
|
goto err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For DEFER_TASKRUN we require the completion task to be the same as the
|
* For DEFER_TASKRUN we require the completion task to be the same as the
|
||||||
* submission task. This implies that there is only one submitter, so enforce
|
* submission task. This implies that there is only one submitter, so enforce
|
||||||
|
Loading…
Reference in New Issue
Block a user