Revision 119e1ef80ecfe0d1deb6378d4ab41f5b71519de1 authored by Al Viro on 09 August 2018, 21:51:32 UTC, committed by Al Viro on 09 August 2018, 21:51:32 UTC
__legitimize_mnt() has two problems - one is that in case of success the check of mount_lock is not ordered wrt preceding increment of refcount, making it possible to have successful __legitimize_mnt() on one CPU just before the otherwise final mntpu() on another, with __legitimize_mnt() not seeing mntput() taking the lock and mntput() not seeing the increment done by __legitimize_mnt(). Solved by a pair of barriers. Another is that failure of __legitimize_mnt() on the second read_seqretry() leaves us with reference that'll need to be dropped by caller; however, if that races with final mntput() we can end up with caller dropping rcu_read_lock() and doing mntput() to release that reference - with the first mntput() having freed the damn thing just as rcu_read_lock() had been dropped. Solution: in "do mntput() yourself" failure case grab mount_lock, check if MNT_DOOMED has been set by racing final mntput() that has missed our increment and if it has - undo the increment and treat that as "failure, caller doesn't need to drop anything" case. It's not easy to hit - the final mntput() has to come right after the first read_seqretry() in __legitimize_mnt() *and* manage to miss the increment done by __legitimize_mnt() before the second read_seqretry() in there. The things that are almost impossible to hit on bare hardware are not impossible on SMP KVM, though... Reported-by: Oleg Nesterov <oleg@redhat.com> Fixes: 48a066e72d97 ("RCU'd vsfmounts") Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 9ea0a46
File | Mode | Size |
---|---|---|
arm | ||
interface | ||
acpi.h | -rw-r--r-- | 3.4 KB |
balloon.h | -rw-r--r-- | 1.3 KB |
events.h | -rw-r--r-- | 4.3 KB |
features.h | -rw-r--r-- | 502 bytes |
grant_table.h | -rw-r--r-- | 9.1 KB |
hvc-console.h | -rw-r--r-- | 518 bytes |
hvm.h | -rw-r--r-- | 1.3 KB |
page.h | -rw-r--r-- | 1.3 KB |
platform_pci.h | -rw-r--r-- | 2.0 KB |
swiotlb-xen.h | -rw-r--r-- | 271 bytes |
tmem.h | -rw-r--r-- | 349 bytes |
xen-ops.h | -rw-r--r-- | 6.7 KB |
xen.h | -rw-r--r-- | 972 bytes |
xenbus.h | -rw-r--r-- | 8.2 KB |
xenbus_dev.h | -rw-r--r-- | 1.8 KB |
Computing file changes ...