1
0
Fork 0
alistair23-linux/fs/cachefiles
Al Viro 169b803397 cachefiles: fix the race between cachefiles_bury_object() and rmdir(2)
the victim might've been rmdir'ed just before the lock_rename();
unlike the normal callers, we do not look the source up after the
parents are locked - we know it beforehand and just recheck that it's
still the child of what used to be its parent.  Unfortunately,
the check is too weak - we don't spot a dead directory since its
->d_parent is unchanged, dentry is positive, etc.  So we sail all
the way to ->rename(), with hosting filesystems _not_ expecting
to be asked renaming an rmdir'ed subdirectory.

The fix is easy, fortunately - the lock on parent is sufficient for
making IS_DEADDIR() on child safe.

Cc: stable@vger.kernel.org
Fixes: 9ae326a690 (CacheFiles: A cache that backs onto a mounted filesystem)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-18 11:32:21 +02:00
..
Kconfig CacheFiles: A cache that backs onto a mounted filesystem 2009-04-03 16:42:41 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bind.c fscache: Fix reference overput in fscache_attach_object() error handling 2018-07-25 14:49:00 +01:00
daemon.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
interface.c fscache: Pass object size in rather than calling back for it 2018-04-06 14:05:14 +01:00
internal.h fscache: Add tracepoints 2018-04-04 13:41:27 +01:00
key.c CacheFiles: Downgrade the requirements passed to the allocator 2012-12-20 21:58:25 +00:00
main.c fscache: Add tracepoints 2018-04-04 13:41:27 +01:00
namei.c cachefiles: fix the race between cachefiles_bury_object() and rmdir(2) 2018-10-18 11:32:21 +02:00
proc.c proc: introduce proc_create_seq{,_data} 2018-05-16 07:23:35 +02:00
rdwr.c cachefiles: Fix refcounting bug in backing-file read monitoring 2018-07-25 14:49:00 +01:00
security.c VFS: fs/cachefiles: d_backing_inode() annotations 2015-04-15 15:06:59 -04:00
xattr.c fscache: Pass object size in rather than calling back for it 2018-04-06 14:05:14 +01:00