linux-IllusionX/fs
Lino Sanfilippo 7b18527c4a fanotify: fix races when adding/removing marks
For both adding an event to an existing mark and destroying a mark we
first have to find it via fsnotify_find_[inode|vfsmount]_mark().  But
getting the mark and adding an event (or destroying it) is not done
atomically.  This opens a race where a thread is about to destroy a mark
while another thread still finds the same mark and adds an event to its
mask although it will be destroyed.

Another race exists concerning the excess of a groups number of marks
limit: When a mark is added the number of group marks is checked against
the max number of marks per group and increased afterwards.  Since check
and increment is also not done atomically, this may result in 2 or more
processes passing the check at the same time and increasing the number
of group marks above the allowed limit.

With this patch both races are avoided by doing the concerning
operations with the groups mark mutex locked.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Cc: Eric Paris <eparis@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-09 10:33:19 -07:00
..
9p
adfs
affs
afs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
autofs4
befs
bfs
btrfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-07-04 11:40:58 -07:00
cachefiles mm: remove lru parameter from __pagevec_lru_add and remove parts of pagevec API 2013-07-03 16:07:31 -07:00
ceph Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
cifs Power management and ACPI updates for 3.11-rc1 2013-07-03 14:35:40 -07:00
coda
configfs configfs: use capped length for ->store_attribute() 2013-07-03 16:07:23 -07:00
cramfs
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
exofs
exportfs
ext2
ext3 mm: vmscan: take page buffers dirty and locked state into account 2013-07-03 16:07:29 -07:00
ext4 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
f2fs This patch-set includes the following major enhancement patches. 2013-07-02 09:42:38 -07:00
fat fs/fat: use fat_msg() to replace printk() in __fat_fs_error() 2013-07-03 16:08:01 -07:00
freevxfs
fscache
fuse mm: use totalram_pages instead of num_physpages at runtime 2013-07-03 16:07:35 -07:00
gfs2 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
hfs
hfsplus
hostfs
hpfs Merge branch 'hpfs' from Mikulas Patocka 2013-07-04 11:22:55 -07:00
hppfs clean up scary strncpy(dst, src, strlen(src)) uses 2013-07-03 16:07:41 -07:00
hugetlbfs
isofs
jbd
jbd2
jffs2
jfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
lockd drivers: avoid parsing names as kthread_run() format strings 2013-07-03 16:07:41 -07:00
logfs
minix
ncpfs ncpfs: use vma_pages() to replace (vm_end - vm_start) >> PAGE_SHIFT 2013-07-03 16:07:26 -07:00
nfs Merge branch 'akpm' (updates from Andrew Morton) 2013-07-03 17:12:13 -07:00
nfs_common
nfsd
nilfs2 ] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct 2013-07-03 16:08:01 -07:00
nls
notify fanotify: fix races when adding/removing marks 2013-07-09 10:33:19 -07:00
ntfs
ocfs2 ocfs2: fix NULL pointer dereference when traversing o2hb_all_regions 2013-07-03 16:07:25 -07:00
omfs
openpromfs
proc fs/proc/kcore.c: using strlcpy() instead of strncpy() 2013-07-03 16:08:02 -07:00
pstore Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2013-07-04 10:29:23 -07:00
qnx4
qnx6
quota
ramfs
reiserfs
romfs
squashfs
sysfs Driver core patches for 3.11-rc1 2013-07-02 11:44:19 -07:00
sysv
ubifs Only a single patch which fixes a message. 2013-07-05 12:08:47 -07:00
udf
ufs
xfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
aio.c aio: fix wrong comment in aio_complete() 2013-07-03 16:08:06 -07:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c
block_dev.c mm: vmscan: take page buffers dirty and locked state into account 2013-07-03 16:07:29 -07:00
buffer.c mm: vmscan: take page buffers dirty and locked state into account 2013-07-03 16:07:29 -07:00
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c coredump: '% at the end' shouldn't bypass core_uses_pid logic 2013-07-03 16:08:02 -07:00
coredump.h
dcache.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c Merge branch 'akpm' (updates from Andrew Morton) 2013-07-03 17:12:13 -07:00
exec.c fs/exec.c:de_thread: mt-exec should update ->real_start_time 2013-07-03 16:08:03 -07:00
fcntl.c
fhandle.c
file.c
file_table.c
filesystems.c
fs-writeback.c
fs_struct.c
generic_acl.c
inode.c
internal.h
ioctl.c
ioprio.c
Kconfig
Kconfig.binfmt
libfs.c
locks.c
Makefile
mbcache.c
mount.h
mpage.c
namei.c
namespace.c
no-block.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c vfs: export lseek_execute() to modules 2013-07-03 16:23:27 +04:00
readdir.c
select.c
seq_file.c
signalfd.c
splice.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
utimes.c
xattr.c
xattr_acl.c