diff options
author | Christoph Hellwig <hch@lst.de> | 2008-11-28 04:09:09 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-03-27 14:43:57 -0400 |
commit | 2b1c6bd77d4e6a727ffac8630cd154b2144b751a (patch) | |
tree | ffc4237dbeed66492124ef2ccecf48db0767531a /arch/mips/kernel/linux32.c | |
parent | ec1ab0abde0af586a59541ad71841f022dcac3e7 (diff) |
generic compat_sys_ustat
Due to a different size of ino_t ustat needs a compat handler, but
currently only x86 and mips provide one. Add a generic compat_sys_ustat
and switch all architectures over to it. Instead of doing various
user copy hacks compat_sys_ustat just reimplements sys_ustat as
it's trivial. This was suggested by Arnd Bergmann.
Found by Eric Sandeen when running xfstests/017 on ppc64, which causes
stack smashing warnings on RHEL/Fedora due to the too large amount of
data writen by the syscall.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/mips/kernel/linux32.c')
-rw-r--r-- | arch/mips/kernel/linux32.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 1a86f84fa947..784859cedef7 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -356,40 +356,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality) | |||
356 | return ret; | 356 | return ret; |
357 | } | 357 | } |
358 | 358 | ||
359 | /* ustat compatibility */ | ||
360 | struct ustat32 { | ||
361 | compat_daddr_t f_tfree; | ||
362 | compat_ino_t f_tinode; | ||
363 | char f_fname[6]; | ||
364 | char f_fpack[6]; | ||
365 | }; | ||
366 | |||
367 | extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf); | ||
368 | |||
369 | SYSCALL_DEFINE2(32_ustat, dev_t, dev, struct ustat32 __user *, ubuf32) | ||
370 | { | ||
371 | int err; | ||
372 | struct ustat tmp; | ||
373 | struct ustat32 tmp32; | ||
374 | mm_segment_t old_fs = get_fs(); | ||
375 | |||
376 | set_fs(KERNEL_DS); | ||
377 | err = sys_ustat(dev, (struct ustat __user *)&tmp); | ||
378 | set_fs(old_fs); | ||
379 | |||
380 | if (err) | ||
381 | goto out; | ||
382 | |||
383 | memset(&tmp32, 0, sizeof(struct ustat32)); | ||
384 | tmp32.f_tfree = tmp.f_tfree; | ||
385 | tmp32.f_tinode = tmp.f_tinode; | ||
386 | |||
387 | err = copy_to_user(ubuf32, &tmp32, sizeof(struct ustat32)) ? -EFAULT : 0; | ||
388 | |||
389 | out: | ||
390 | return err; | ||
391 | } | ||
392 | |||
393 | SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd, | 359 | SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd, |
394 | compat_off_t __user *, offset, s32, count) | 360 | compat_off_t __user *, offset, s32, count) |
395 | { | 361 | { |