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

Commit 50157b09 authored by Alexandr Andreev's avatar Alexandr Andreev Committed by Tony Luck
Browse files

[IA64] sync compat getdents



Add VERIFY_WRITE check in the beginning like compat_sys_getdents() (EINVAL vs
EFAULT).

Signed-off-by: default avatarAlexandr Andreev <aandreev@openvz.org>
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent a27e5a13
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1267,6 +1267,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i
	struct getdents32_callback buf;
	int error;

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

	error = -EBADF;
	file = fget(fd);
	if (!file)
@@ -1283,9 +1287,9 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i
	error = buf.error;
	lastdirent = buf.previous;
	if (lastdirent) {
		error = -EINVAL;
		if (put_user(file->f_pos, &lastdirent->d_off))
			goto out_putf;
			error = -EFAULT;
		else
			error = count - buf.count;
	}