ext4: use dget_parent() in ext4_file_open()
authorMiklos Szeredi <mszeredi@redhat.com>
Sat, 26 Mar 2016 20:14:41 +0000 (16:14 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 26 Mar 2016 20:14:41 +0000 (16:14 -0400)
commit9dd78d8c9a7bd4bc341f5864db32d4331b8eae4c
tree2f70946530b1e90ab39560b206827e460c1444d5
parentbe62a1a8fd116f5cd9e53726601f970e16e17558
ext4: use dget_parent() in ext4_file_open()

In f_op->open() lock on parent is not held, so there's no guarantee that
parent dentry won't go away at any time.

Even after this patch there's no guarantee that 'dir' will stay the parent
of 'inode', but at least it won't be freed while being used.

Fixes: ff978b09f973 ("ext4 crypto: move context consistency check to ext4_file_open()")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: <stable@vger.kernel.org> # v4.5
fs/ext4/file.c