• Dave Hansen's avatar
    inotify: actually check for invalid bits in sys_inotify_add_watch() · d30e2c05
    Dave Hansen authored
    The comment here says that it is checking for invalid bits.  But, the mask
    is *actually* checking to ensure that _any_ valid bit is set, which is
    quite different.
    
    Without this check, an unexpected bit could get set on an inotify object.
    Since these bits are also interpreted by the fsnotify/dnotify code, there
    is the potential for an object to be mishandled inside the kernel.  For
    instance, can we be sure that setting the dnotify flag FS_DN_RENAME on an
    inotify watch is harmless?
    
    Add the actual check which was intended.  Retain the existing inotify bits
    are being added to the watch.  Plus, this is existing behavior which would
    be nice to preserve.
    
    I did a quick sniff test that inotify functions and that my
    'inotify-tools' package passes 'make check'.
    Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
    Cc: John McCutchan <john@johnmccutchan.com>
    Cc: Robert Love <rlove@rlove.org>
    Cc: Eric Paris <eparis@parisplace.org>
    Cc: Josh Boyer <jwboyer@fedoraproject.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    d30e2c05
Name
Last commit
Last update
..
dnotify Loading commit data...
fanotify Loading commit data...
inotify Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
fdinfo.c Loading commit data...
fdinfo.h Loading commit data...
fsnotify.c Loading commit data...
fsnotify.h Loading commit data...
group.c Loading commit data...
inode_mark.c Loading commit data...
mark.c Loading commit data...
notification.c Loading commit data...
vfsmount_mark.c Loading commit data...