aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fsnotify.h
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-10-28 17:21:56 -0400
committerEric Paris <eparis@redhat.com>2010-10-28 17:22:13 -0400
commit52420392c81c8712f555e6bcd116d8bd214ce43a (patch)
tree372d23bba71ee687ff5adf5b83d3fd0706e19927 /include/linux/fsnotify.h
parentff8bcbd03da881bf1171910c6c07d44bd3c0a234 (diff)
fsnotify: call fsnotify_parent in perm events
fsnotify perm events do not call fsnotify parent. That means you cannot register a perm event on a directory and enforce permissions on all inodes in that directory. This patch fixes that situation. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'include/linux/fsnotify.h')
-rw-r--r--include/linux/fsnotify.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 59d0df43ff9d..5059faacceab 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -26,12 +26,12 @@ static inline void fsnotify_d_instantiate(struct dentry *dentry,
26} 26}
27 27
28/* Notify this dentry's parent about a child's events. */ 28/* Notify this dentry's parent about a child's events. */
29static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) 29static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
30{ 30{
31 if (!dentry) 31 if (!dentry)
32 dentry = path->dentry; 32 dentry = path->dentry;
33 33
34 __fsnotify_parent(path, dentry, mask); 34 return __fsnotify_parent(path, dentry, mask);
35} 35}
36 36
37/* simple call site for access decisions */ 37/* simple call site for access decisions */
@@ -40,6 +40,7 @@ static inline int fsnotify_perm(struct file *file, int mask)
40 struct path *path = &file->f_path; 40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode; 41 struct inode *inode = path->dentry->d_inode;
42 __u32 fsnotify_mask = 0; 42 __u32 fsnotify_mask = 0;
43 int ret;
43 44
44 if (file->f_mode & FMODE_NONOTIFY) 45 if (file->f_mode & FMODE_NONOTIFY)
45 return 0; 46 return 0;
@@ -52,6 +53,10 @@ static inline int fsnotify_perm(struct file *file, int mask)
52 else 53 else
53 BUG(); 54 BUG();
54 55
56 ret = fsnotify_parent(path, NULL, fsnotify_mask);
57 if (ret)
58 return ret;
59
55 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); 60 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
56} 61}
57 62