@@ -9004,7 +9004,7 @@ static int io_close_fixed(struct io_kiocb *req, unsigned int issue_flags)
9004
9004
bool needs_lock = issue_flags & IO_URING_F_UNLOCKED ;
9005
9005
struct io_fixed_file * file_slot ;
9006
9006
struct file * file ;
9007
- int ret , i ;
9007
+ int ret ;
9008
9008
9009
9009
io_ring_submit_lock (ctx , needs_lock );
9010
9010
ret = - ENXIO ;
@@ -9017,8 +9017,8 @@ static int io_close_fixed(struct io_kiocb *req, unsigned int issue_flags)
9017
9017
if (ret )
9018
9018
goto out ;
9019
9019
9020
- i = array_index_nospec (offset , ctx -> nr_user_files );
9021
- file_slot = io_fixed_file_slot (& ctx -> file_table , i );
9020
+ offset = array_index_nospec (offset , ctx -> nr_user_files );
9021
+ file_slot = io_fixed_file_slot (& ctx -> file_table , offset );
9022
9022
ret = - EBADF ;
9023
9023
if (!file_slot -> file_ptr )
9024
9024
goto out ;
@@ -9074,8 +9074,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
9074
9074
9075
9075
if (file_slot -> file_ptr ) {
9076
9076
file = (struct file * )(file_slot -> file_ptr & FFS_MASK );
9077
- err = io_queue_rsrc_removal (data , up -> offset + done ,
9078
- ctx -> rsrc_node , file );
9077
+ err = io_queue_rsrc_removal (data , i , ctx -> rsrc_node , file );
9079
9078
if (err )
9080
9079
break ;
9081
9080
file_slot -> file_ptr = 0 ;
@@ -9758,7 +9757,7 @@ static int __io_sqe_buffers_update(struct io_ring_ctx *ctx,
9758
9757
9759
9758
i = array_index_nospec (offset , ctx -> nr_user_bufs );
9760
9759
if (ctx -> user_bufs [i ] != ctx -> dummy_ubuf ) {
9761
- err = io_queue_rsrc_removal (ctx -> buf_data , offset ,
9760
+ err = io_queue_rsrc_removal (ctx -> buf_data , i ,
9762
9761
ctx -> rsrc_node , ctx -> user_bufs [i ]);
9763
9762
if (unlikely (err )) {
9764
9763
io_buffer_unmap (ctx , & imu );
0 commit comments