@@ -482,7 +482,7 @@ struct io_statx {
482
482
int dfd ;
483
483
unsigned int mask ;
484
484
unsigned int flags ;
485
- struct filename * filename ;
485
+ const char __user * filename ;
486
486
struct statx __user * buffer ;
487
487
};
488
488
@@ -3376,43 +3376,23 @@ static int io_fadvise(struct io_kiocb *req, bool force_nonblock)
3376
3376
3377
3377
static int io_statx_prep (struct io_kiocb * req , const struct io_uring_sqe * sqe )
3378
3378
{
3379
- const char __user * fname ;
3380
- unsigned lookup_flags ;
3381
- int ret ;
3382
-
3383
3379
if (sqe -> ioprio || sqe -> buf_index )
3384
3380
return - EINVAL ;
3385
3381
if (req -> flags & REQ_F_FIXED_FILE )
3386
3382
return - EBADF ;
3387
- if (req -> flags & REQ_F_NEED_CLEANUP )
3388
- return 0 ;
3389
3383
3390
3384
req -> statx .dfd = READ_ONCE (sqe -> fd );
3391
3385
req -> statx .mask = READ_ONCE (sqe -> len );
3392
- fname = u64_to_user_ptr (READ_ONCE (sqe -> addr ));
3386
+ req -> statx . filename = u64_to_user_ptr (READ_ONCE (sqe -> addr ));
3393
3387
req -> statx .buffer = u64_to_user_ptr (READ_ONCE (sqe -> addr2 ));
3394
3388
req -> statx .flags = READ_ONCE (sqe -> statx_flags );
3395
3389
3396
- if (vfs_stat_set_lookup_flags (& lookup_flags , req -> statx .flags ))
3397
- return - EINVAL ;
3398
-
3399
- req -> statx .filename = getname_flags (fname , lookup_flags , NULL );
3400
- if (IS_ERR (req -> statx .filename )) {
3401
- ret = PTR_ERR (req -> statx .filename );
3402
- req -> statx .filename = NULL ;
3403
- return ret ;
3404
- }
3405
-
3406
- req -> flags |= REQ_F_NEED_CLEANUP ;
3407
3390
return 0 ;
3408
3391
}
3409
3392
3410
3393
static int io_statx (struct io_kiocb * req , bool force_nonblock )
3411
3394
{
3412
3395
struct io_statx * ctx = & req -> statx ;
3413
- unsigned lookup_flags ;
3414
- struct path path ;
3415
- struct kstat stat ;
3416
3396
int ret ;
3417
3397
3418
3398
if (force_nonblock ) {
@@ -3422,29 +3402,9 @@ static int io_statx(struct io_kiocb *req, bool force_nonblock)
3422
3402
return - EAGAIN ;
3423
3403
}
3424
3404
3425
- if (vfs_stat_set_lookup_flags (& lookup_flags , ctx -> flags ))
3426
- return - EINVAL ;
3427
-
3428
- retry :
3429
- /* filename_lookup() drops it, keep a reference */
3430
- ctx -> filename -> refcnt ++ ;
3431
-
3432
- ret = filename_lookup (ctx -> dfd , ctx -> filename , lookup_flags , & path ,
3433
- NULL );
3434
- if (ret )
3435
- goto err ;
3405
+ ret = do_statx (ctx -> dfd , ctx -> filename , ctx -> flags , ctx -> mask ,
3406
+ ctx -> buffer );
3436
3407
3437
- ret = vfs_getattr (& path , & stat , ctx -> mask , ctx -> flags );
3438
- path_put (& path );
3439
- if (retry_estale (ret , lookup_flags )) {
3440
- lookup_flags |= LOOKUP_REVAL ;
3441
- goto retry ;
3442
- }
3443
- if (!ret )
3444
- ret = cp_statx (& stat , ctx -> buffer );
3445
- err :
3446
- putname (ctx -> filename );
3447
- req -> flags &= ~REQ_F_NEED_CLEANUP ;
3448
3408
if (ret < 0 )
3449
3409
req_set_fail_links (req );
3450
3410
io_cqring_add_event (req , ret );
@@ -5196,8 +5156,6 @@ static void io_cleanup_req(struct io_kiocb *req)
5196
5156
break ;
5197
5157
case IORING_OP_OPENAT :
5198
5158
case IORING_OP_OPENAT2 :
5199
- case IORING_OP_STATX :
5200
- putname (req -> open .filename );
5201
5159
break ;
5202
5160
case IORING_OP_SPLICE :
5203
5161
case IORING_OP_TEE :
0 commit comments