Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c8307f6 authored by Alexandr Andreev's avatar Alexandr Andreev Committed by Kyle McMartin
Browse files

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: default avatarAlexandr Andreev <aandreev@openvz.org>
Signed-off-by: default avatarAlexey 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent 01da41b8
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -350,6 +350,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
	struct getdents32_callback buf;
	int error;

	error = -EFAULT;
	if (!access_ok(VERIFY_WRITE, dirent, count))
		goto out;

	error = -EBADF;
	file = fget(fd);
	if (!file)
@@ -366,7 +370,9 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
	error = buf.error;
	lastdirent = buf.previous;
	if (lastdirent) {
		put_user(file->f_pos, &lastdirent->d_off);
		if (put_user(file->f_pos, &lastdirent->d_off))
			error = -EFAULT;
		else
			error = count - buf.count;
	}