From 329463fab5e8d05e8898cfb8c175a49a482e1520 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Thu, 15 Apr 2021 17:31:25 +0800 Subject: [PATCH] io_uring: Fix __io_uring_register() false success mainline inclusion from mainline-5.2-rc3 commit a278682dad37fd2f8d2f30d8e84e376a856ab472 category: feature bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27 CVE: NA --------------------------- If io_copy_iov() fails, it will break the loop and report success, albeit partially completed operation. Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Zhihao Cheng Signed-off-by: yangerkun Reviewed-by: zhangyi (F) Signed-off-by: Cheng Jian --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 62a73623601d..3229b34e0fe0 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2609,7 +2609,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void __user *arg, ret = io_copy_iov(ctx, &iov, arg, i); if (ret) - break; + goto err; /* * Don't impose further limits on the size and buffer -- GitLab