aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/stat.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/stat.c b/fs/stat.c
index c6c963b2546b..3d85747bd86e 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -547,13 +547,13 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
547/** 547/**
548 * sys_statx - System call to get enhanced stats 548 * sys_statx - System call to get enhanced stats
549 * @dfd: Base directory to pathwalk from *or* fd to stat. 549 * @dfd: Base directory to pathwalk from *or* fd to stat.
550 * @filename: File to stat *or* NULL. 550 * @filename: File to stat or "" with AT_EMPTY_PATH
551 * @flags: AT_* flags to control pathwalk. 551 * @flags: AT_* flags to control pathwalk.
552 * @mask: Parts of statx struct actually required. 552 * @mask: Parts of statx struct actually required.
553 * @buffer: Result buffer. 553 * @buffer: Result buffer.
554 * 554 *
555 * Note that if filename is NULL, then it does the equivalent of fstat() using 555 * Note that fstat() can be emulated by setting dfd to the fd of interest,
556 * dfd to indicate the file of interest. 556 * supplying "" as the filename and setting AT_EMPTY_PATH in the flags.
557 */ 557 */
558SYSCALL_DEFINE5(statx, 558SYSCALL_DEFINE5(statx,
559 int, dfd, const char __user *, filename, unsigned, flags, 559 int, dfd, const char __user *, filename, unsigned, flags,
@@ -567,11 +567,10 @@ SYSCALL_DEFINE5(statx,
567 return -EINVAL; 567 return -EINVAL;
568 if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE) 568 if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
569 return -EINVAL; 569 return -EINVAL;
570 if (!filename)
571 return -EINVAL;
570 572
571 if (filename) 573 error = vfs_statx(dfd, filename, flags, &stat, mask);
572 error = vfs_statx(dfd, filename, flags, &stat, mask);
573 else
574 error = vfs_statx_fd(dfd, &stat, mask, flags);
575 if (error) 574 if (error)
576 return error; 575 return error;
577 576