]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
ecryptfs: fix handling of directory opening
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 8 Jun 2016 18:20:33 +0000 (19:20 +0100)
committerAndy Whitcroft <apw@canonical.com>
Wed, 8 Jun 2016 18:37:33 +0000 (19:37 +0100)
commit1be0aa470da233e4757f59880a4cd7499a7b04ac
tree9d04a9bd6c5f269fff740a21e0c0c68dc3cc6c88
parent61e9a226a1c244d9485b3d5fd89d8941998cb224
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>
(cherry picked from commit 6a480a7842545ec520a91730209ec0bae41694c1)
Acked-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
fs/ecryptfs/file.c