Commit f38aa942 authored by Amy Griffis's avatar Amy Griffis Committed by Al Viro

[PATCH] Pass dentry, not just name, in fsnotify creation hooks.

The audit hooks (to be added shortly) will want to see dentry->d_inode
too, not just the name.
Signed-off-by: default avatarAmy Griffis <amy.griffis@hp.com>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 90d526c0
...@@ -1472,7 +1472,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -1472,7 +1472,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
DQUOT_INIT(dir); DQUOT_INIT(dir);
error = dir->i_op->create(dir, dentry, mode, nd); error = dir->i_op->create(dir, dentry, mode, nd);
if (!error) if (!error)
fsnotify_create(dir, dentry->d_name.name); fsnotify_create(dir, dentry);
return error; return error;
} }
...@@ -1793,7 +1793,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) ...@@ -1793,7 +1793,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
DQUOT_INIT(dir); DQUOT_INIT(dir);
error = dir->i_op->mknod(dir, dentry, mode, dev); error = dir->i_op->mknod(dir, dentry, mode, dev);
if (!error) if (!error)
fsnotify_create(dir, dentry->d_name.name); fsnotify_create(dir, dentry);
return error; return error;
} }
...@@ -1870,7 +1870,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -1870,7 +1870,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
DQUOT_INIT(dir); DQUOT_INIT(dir);
error = dir->i_op->mkdir(dir, dentry, mode); error = dir->i_op->mkdir(dir, dentry, mode);
if (!error) if (!error)
fsnotify_mkdir(dir, dentry->d_name.name); fsnotify_mkdir(dir, dentry);
return error; return error;
} }
...@@ -2133,7 +2133,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, i ...@@ -2133,7 +2133,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, i
DQUOT_INIT(dir); DQUOT_INIT(dir);
error = dir->i_op->symlink(dir, dentry, oldname); error = dir->i_op->symlink(dir, dentry, oldname);
if (!error) if (!error)
fsnotify_create(dir, dentry->d_name.name); fsnotify_create(dir, dentry);
return error; return error;
} }
...@@ -2210,7 +2210,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de ...@@ -2210,7 +2210,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
error = dir->i_op->link(old_dentry, dir, new_dentry); error = dir->i_op->link(old_dentry, dir, new_dentry);
mutex_unlock(&old_dentry->d_inode->i_mutex); mutex_unlock(&old_dentry->d_inode->i_mutex);
if (!error) if (!error)
fsnotify_create(dir, new_dentry->d_name.name); fsnotify_create(dir, new_dentry);
return error; return error;
} }
......
...@@ -70,19 +70,20 @@ static inline void fsnotify_inoderemove(struct inode *inode) ...@@ -70,19 +70,20 @@ static inline void fsnotify_inoderemove(struct inode *inode)
/* /*
* fsnotify_create - 'name' was linked in * fsnotify_create - 'name' was linked in
*/ */
static inline void fsnotify_create(struct inode *inode, const char *name) static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
{ {
inode_dir_notify(inode, DN_CREATE); inode_dir_notify(inode, DN_CREATE);
inotify_inode_queue_event(inode, IN_CREATE, 0, name); inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name);
} }
/* /*
* fsnotify_mkdir - directory 'name' was created * fsnotify_mkdir - directory 'name' was created
*/ */
static inline void fsnotify_mkdir(struct inode *inode, const char *name) static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
{ {
inode_dir_notify(inode, DN_CREATE); inode_dir_notify(inode, DN_CREATE);
inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name); inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
dentry->d_name.name);
} }
/* /*
......
...@@ -515,7 +515,7 @@ static int audit_filter_rules(struct task_struct *tsk, ...@@ -515,7 +515,7 @@ static int audit_filter_rules(struct task_struct *tsk,
case AUDIT_INODE: case AUDIT_INODE:
if (ctx) { if (ctx) {
for (j = 0; j < ctx->name_count; j++) { for (j = 0; j < ctx->name_count; j++) {
if (audit_comparator(ctx->names[j].ino, op, value)) { if ( audit_comparator(ctx->names[j].ino, op, value)) {
++result; ++result;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment