aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorAlexandr Andreev <aandreev@openvz.org>2007-03-06 05:44:13 -0500
committerKyle McMartin <kyle@athena.road.mcmartin.ca>2007-05-22 22:42:56 -0400
commit2c8307f63dd5caaf7ff8ad5118951e559a9ed5c8 (patch)
tree2dba2da76dce00fe73374f02ed7c72b1d8b11373 /arch/parisc
parent01da41b86f6e5f9a724e20a63f093d77e37d8056 (diff)
parisc: sync compat getdents
Add VERIFY_WRITE check in the beginning like compat_sys_getdents() EFAULT on parisc if put_user() fails. Signed-off-by: Alexandr Andreev <aandreev@openvz.org> Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Matthew Wilcox <willy@debian.org> Cc: Grant Grundler <grundler@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/kernel/sys_parisc32.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index ce3245f87fdd..a8ebac4fadec 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -350,6 +350,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
350 struct getdents32_callback buf; 350 struct getdents32_callback buf;
351 int error; 351 int error;
352 352
353 error = -EFAULT;
354 if (!access_ok(VERIFY_WRITE, dirent, count))
355 goto out;
356
353 error = -EBADF; 357 error = -EBADF;
354 file = fget(fd); 358 file = fget(fd);
355 if (!file) 359 if (!file)
@@ -366,8 +370,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
366 error = buf.error; 370 error = buf.error;
367 lastdirent = buf.previous; 371 lastdirent = buf.previous;
368 if (lastdirent) { 372 if (lastdirent) {
369 put_user(file->f_pos, &lastdirent->d_off); 373 if (put_user(file->f_pos, &lastdirent->d_off))
370 error = count - buf.count; 374 error = -EFAULT;
375 else
376 error = count - buf.count;
371 } 377 }
372 378
373out_putf: 379out_putf: