]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: Don't let __fdget_pos() get FMODE_PATH files
authorEric Biggers <ebiggers3@gmail.com>
Sun, 16 Mar 2014 20:47:48 +0000 (15:47 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 23 Mar 2014 04:03:12 +0000 (00:03 -0400)
commitadb2d1b4f06075790c7667726cfd4841e72d1a10
tree6b57fe890caaa2ff026a9d54a42f9ac95b96fee9
parent4fe1cf5debe0f1daf1454f9ad2df8696587df7e8
vfs: Don't let __fdget_pos() get FMODE_PATH files

Commit 2755c6bc3b1f6 ("get rid of fget_light()") introduced the
__fdget_pos() function, which returns the resulting file pointer and
fdput flags combined in an 'unsigned long'.  However, it also changed the
behavior to return files with FMODE_PATH set, which shouldn't happen
because read(), write(), lseek(), etc. aren't allowed on such files.
This commit restores the old behavior.

This regression actually had no effect on read() and write() since
FMODE_READ and FMODE_WRITE are not set on file descriptors opened with
O_PATH, but it did cause lseek() on a file descriptor opened with O_PATH
to fail with ESPIPE rather than EBADF.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/file.c