Re: [PATCH 5.19 2/6] io_uring: openclose: fix bug of closing wrong fixed file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/11/22 13:22, Hao Xu wrote:
From: Hao Xu <howeyxu@xxxxxxxxxxx>

Don't update ret until fixed file is closed, otherwise the file slot
becomes the error code.

Fixes: a7c41b4687f5 ("io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots")
Signed-off-by: Hao Xu <howeyxu@xxxxxxxxxxx>
---
  io_uring/rsrc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c

Something strange is going on here, io_uring/rsrc.c was only queued for
5.20, but it's marked 5.19, weird.


index d78e7f2ea91f..cf8c85d1fb59 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -705,8 +705,8 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
  		if (ret < 0)
  			break;
  		if (copy_to_user(&fds[done], &ret, sizeof(ret))) {
-			ret = -EFAULT;
  			__io_close_fixed(req, issue_flags, ret);
+			ret = -EFAULT;
  			break;
  		}
  	}

--
Pavel Begunkov



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux