diff options
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/compat.c b/fs/compat.c index 0949b43794a4..5e374aad33f7 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -378,6 +378,34 @@ out: | |||
378 | return error; | 378 | return error; |
379 | } | 379 | } |
380 | 380 | ||
381 | /* | ||
382 | * This is a copy of sys_ustat, just dealing with a structure layout. | ||
383 | * Given how simple this syscall is that apporach is more maintainable | ||
384 | * than the various conversion hacks. | ||
385 | */ | ||
386 | asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u) | ||
387 | { | ||
388 | struct super_block *sb; | ||
389 | struct compat_ustat tmp; | ||
390 | struct kstatfs sbuf; | ||
391 | int err; | ||
392 | |||
393 | sb = user_get_super(new_decode_dev(dev)); | ||
394 | if (!sb) | ||
395 | return -EINVAL; | ||
396 | err = vfs_statfs(sb->s_root, &sbuf); | ||
397 | drop_super(sb); | ||
398 | if (err) | ||
399 | return err; | ||
400 | |||
401 | memset(&tmp, 0, sizeof(struct compat_ustat)); | ||
402 | tmp.f_tfree = sbuf.f_bfree; | ||
403 | tmp.f_tinode = sbuf.f_ffree; | ||
404 | if (copy_to_user(u, &tmp, sizeof(struct compat_ustat))) | ||
405 | return -EFAULT; | ||
406 | return 0; | ||
407 | } | ||
408 | |||
381 | static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl) | 409 | static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl) |
382 | { | 410 | { |
383 | if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)) || | 411 | if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)) || |