Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
---
fs/io_uring.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
-@@ -2798,6 +2798,12 @@ static int io_sq_thread(void *data)
- }
- }
-
+@@ -3716,6 +3716,12 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned
+ wake_up(&ctx->sqo_wait);
+ submitted = to_submit;
+ } else if (to_submit) {
+ if (current->mm != ctx->sqo_mm ||
+ current_cred() != ctx->creds) {
+ ret = -EPERM;
+ }
+
to_submit = min(to_submit, ctx->sq_entries);
- inflight += io_submit_sqes(ctx, to_submit, cur_mm != NULL,
- mm_fault);
+
+ mutex_lock(&ctx->uring_lock);