]> git.baikalelectronics.ru Git - kernel.git/commit
ecryptfs: fix handling of directory opening
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 4 May 2016 18:04:13 +0000 (14:04 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 4 May 2016 18:04:13 +0000 (14:04 -0400)
commit5b33ee167d456b5ca42c470a41e47b8c68b98eff
treeba40d93639c0cce7e461880199023d371f1b2535
parentd4acd40712752f6d31f90938652672ce56547959
ecryptfs: fix handling of directory opening

First of all, trying to open them r/w is idiocy; it's guaranteed to fail.
Moreover, assigning ->f_pos and assuming that everything will work is
blatantly broken - try that with e.g. tmpfs as underlying layer and watch
the fireworks.  There may be a non-trivial amount of state associated with
current IO position, well beyond the numeric offset.  Using the single
struct file associated with underlying inode is really not a good idea;
we ought to open one for each ecryptfs directory struct file.

Additionally, file_operations both for directories and non-directories are
full of pointless methods; non-directories should *not* have ->iterate(),
directories should not have ->flush(), ->fasync() and ->splice_read().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ecryptfs/file.c