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

Commit c44ed965 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds
Browse files

compat breakage in preadv() and pwritev()



Fix for a dumb preadv()/pwritev() compat bug - unlike the native
variants, the compat_...  ones forget to check FMODE_P{READ,WRITE}, so
e.g.  on pipe the native preadv() will fail with -ESPIPE and compat one
will act as readv() and succeed.

Not critical, but it's a clear bug with trivial fix, so IMO it's OK for
-final.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c9a816c0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1228,6 +1228,8 @@ compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
	file = fget_light(fd, &fput_needed);
	if (!file)
		return -EBADF;
	ret = -ESPIPE;
	if (file->f_mode & FMODE_PREAD)
		ret = compat_readv(file, vec, vlen, &pos);
	fput_light(file, fput_needed);
	return ret;
@@ -1285,6 +1287,8 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
	file = fget_light(fd, &fput_needed);
	if (!file)
		return -EBADF;
	ret = -ESPIPE;
	if (file->f_mode & FMODE_PWRITE)
		ret = compat_writev(file, vec, vlen, &pos);
	fput_light(file, fput_needed);
	return ret;