Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Al Viro and committed by
Linus Torvalds
c44ed965 c9a816c0

+6 -2
+6 -2
fs/compat.c
··· 1228 1228 file = fget_light(fd, &fput_needed); 1229 1229 if (!file) 1230 1230 return -EBADF; 1231 - ret = compat_readv(file, vec, vlen, &pos); 1231 + ret = -ESPIPE; 1232 + if (file->f_mode & FMODE_PREAD) 1233 + ret = compat_readv(file, vec, vlen, &pos); 1232 1234 fput_light(file, fput_needed); 1233 1235 return ret; 1234 1236 } ··· 1287 1285 file = fget_light(fd, &fput_needed); 1288 1286 if (!file) 1289 1287 return -EBADF; 1290 - ret = compat_writev(file, vec, vlen, &pos); 1288 + ret = -ESPIPE; 1289 + if (file->f_mode & FMODE_PWRITE) 1290 + ret = compat_writev(file, vec, vlen, &pos); 1291 1291 fput_light(file, fput_needed); 1292 1292 return ret; 1293 1293 }