aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLino Sanfilippo <LinoSanfilippo@gmx.de>2010-11-05 17:05:27 +0100
committerEric Paris <eparis@redhat.com>2010-12-07 16:14:21 -0500
commitb1085ba80cd2784400a7beec3fda5099198ed01c (patch)
treec83530f7d7f161c898d464fc1ce65be38a0268c1 /fs
parent88d60c32765716289abeb362c44adf6c35c6824c (diff)
downloadkernel_samsung_crespo-b1085ba80cd2784400a7beec3fda5099198ed01c.zip
kernel_samsung_crespo-b1085ba80cd2784400a7beec3fda5099198ed01c.tar.gz
kernel_samsung_crespo-b1085ba80cd2784400a7beec3fda5099198ed01c.tar.bz2
fanotify: if set by user unset FMODE_NONOTIFY before fsnotify_perm() is called
Unsetting FMODE_NONOTIFY in fsnotify_open() is too late, since fsnotify_perm() is called before. If FMODE_NONOTIFY is set fsnotify_perm() will skip permission checks, so a user can still disable permission checks by setting this flag in an open() call. This patch corrects this by unsetting the flag before fsnotify_perm is called. Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 5362af9..4ff7ca5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1748,6 +1748,9 @@ struct file *do_filp_open(int dfd, const char *pathname,
if (!(open_flag & O_CREAT))
mode = 0;
+ /* Must never be set by userspace */
+ open_flag &= ~FMODE_NONOTIFY;
+
/*
* O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only
* check for O_DSYNC if the need any syncing at all we enforce it's