linux-stable/fs/ecryptfs
Al Viro bdae2f7b20 ecryptfs_lookup_interpose(): lower_dentry->d_parent is not stable either
commit 762c69685f upstream.

We need to get the underlying dentry of parent; sure, absent the races
it is the parent of underlying dentry, but there's nothing to prevent
losing a timeslice to preemtion in the middle of evaluation of
lower_dentry->d_parent->d_inode, having another process move lower_dentry
around and have its (ex)parent not pinned anymore and freed on memory
pressure.  Then we regain CPU and try to fetch ->d_inode from memory
that is freed by that point.

dentry->d_parent *is* stable here - it's an argument of ->lookup() and
we are guaranteed that it won't be moved anywhere until we feed it
to d_add/d_splice_alias.  So we safely go that way to get to its
underlying dentry.

Cc: stable@vger.kernel.org # since 2009 or so
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-20 18:45:18 +01:00
..
crypto.c eCryptfs: fix a couple type promotion bugs 2019-07-26 09:14:29 +02:00
debug.c
dentry.c eCryptfs: Invalidate dcache entries when lower i_nlink is zero 2015-08-18 17:29:48 -05:00
ecryptfs_kernel.h ecryptfs: remove private bin2hex implementation 2017-11-04 22:16:41 +00:00
file.c eCryptfs: don't pass up plaintext names when using filename encryption 2018-04-16 18:51:22 +00:00
inode.c ecryptfs_lookup_interpose(): lower_dentry->d_parent is not stable either 2019-11-20 18:45:18 +01:00
Kconfig Minor code cleanups and new Kconfig option to disable /dev/ecryptfs 2013-03-07 12:47:24 -08:00
keystore.c ecryptfs: fix spelling mistake: "cadidate" -> "candidate" 2018-03-29 01:33:30 +00:00
kthread.c scripts/spelling.txt: add "againt" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
main.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
Makefile eCryptfs: allow userspace messaging to be disabled 2013-03-03 23:59:59 -08:00
messaging.c ecryptfs: Delete 21 error messages for a failed memory allocation 2017-11-06 18:23:29 +00:00
miscdev.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
mmap.c ecryptfs: Delete 21 error messages for a failed memory allocation 2017-11-06 18:23:29 +00:00
read_write.c fs: fix kernel_write prototype 2017-09-04 19:05:15 -04:00
super.c eCryptfs: Do not allocate hash tfm in NORECLAIM context 2016-04-20 17:50:01 +08:00