aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c2
-rw-r--r--include/linux/audit.h11
-rw-r--r--include/linux/fsnotify.h8
-rw-r--r--kernel/auditsc.c7
4 files changed, 12 insertions, 16 deletions
diff --git a/fs/namei.c b/fs/namei.c
index f69df876fac3..865282f8e012 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1337,7 +1337,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
1337 return -ENOENT; 1337 return -ENOENT;
1338 1338
1339 BUG_ON(victim->d_parent->d_inode != dir); 1339 BUG_ON(victim->d_parent->d_inode != dir);
1340 audit_inode_child(victim->d_name.name, victim, dir); 1340 audit_inode_child(victim, dir);
1341 1341
1342 error = inode_permission(dir, MAY_WRITE | MAY_EXEC); 1342 error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
1343 if (error) 1343 if (error)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 3c7a358241a7..f391d45c8aea 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -424,7 +424,7 @@ extern void audit_syscall_exit(int failed, long return_code);
424extern void __audit_getname(const char *name); 424extern void __audit_getname(const char *name);
425extern void audit_putname(const char *name); 425extern void audit_putname(const char *name);
426extern void __audit_inode(const char *name, const struct dentry *dentry); 426extern void __audit_inode(const char *name, const struct dentry *dentry);
427extern void __audit_inode_child(const char *dname, const struct dentry *dentry, 427extern void __audit_inode_child(const struct dentry *dentry,
428 const struct inode *parent); 428 const struct inode *parent);
429extern void __audit_ptrace(struct task_struct *t); 429extern void __audit_ptrace(struct task_struct *t);
430 430
@@ -442,11 +442,10 @@ static inline void audit_inode(const char *name, const struct dentry *dentry) {
442 if (unlikely(!audit_dummy_context())) 442 if (unlikely(!audit_dummy_context()))
443 __audit_inode(name, dentry); 443 __audit_inode(name, dentry);
444} 444}
445static inline void audit_inode_child(const char *dname, 445static inline void audit_inode_child(const struct dentry *dentry,
446 const struct dentry *dentry,
447 const struct inode *parent) { 446 const struct inode *parent) {
448 if (unlikely(!audit_dummy_context())) 447 if (unlikely(!audit_dummy_context()))
449 __audit_inode_child(dname, dentry, parent); 448 __audit_inode_child(dentry, parent);
450} 449}
451void audit_core_dumps(long signr); 450void audit_core_dumps(long signr);
452 451
@@ -544,9 +543,9 @@ extern int audit_signals;
544#define audit_getname(n) do { ; } while (0) 543#define audit_getname(n) do { ; } while (0)
545#define audit_putname(n) do { ; } while (0) 544#define audit_putname(n) do { ; } while (0)
546#define __audit_inode(n,d) do { ; } while (0) 545#define __audit_inode(n,d) do { ; } while (0)
547#define __audit_inode_child(d,i,p) do { ; } while (0) 546#define __audit_inode_child(i,p) do { ; } while (0)
548#define audit_inode(n,d) do { ; } while (0) 547#define audit_inode(n,d) do { ; } while (0)
549#define audit_inode_child(d,i,p) do { ; } while (0) 548#define audit_inode_child(i,p) do { ; } while (0)
550#define audit_core_dumps(i) do { ; } while (0) 549#define audit_core_dumps(i) do { ; } while (0)
551#define auditsc_get_stamp(c,t,s) (0) 550#define auditsc_get_stamp(c,t,s) (0)
552#define audit_get_loginuid(t) (-1) 551#define audit_get_loginuid(t) (-1)
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 2d755c49c324..df8fd9a3b214 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -104,7 +104,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
104 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); 104 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
105 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 105 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
106 } 106 }
107 audit_inode_child(new_name, moved, new_dir); 107 audit_inode_child(moved, new_dir);
108} 108}
109 109
110/* 110/*
@@ -147,7 +147,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
147{ 147{
148 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 148 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
149 dentry->d_inode); 149 dentry->d_inode);
150 audit_inode_child(dentry->d_name.name, dentry, inode); 150 audit_inode_child(dentry, inode);
151 151
152 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 152 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
153} 153}
@@ -162,7 +162,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
162 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, 162 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
163 inode); 163 inode);
164 fsnotify_link_count(inode); 164 fsnotify_link_count(inode);
165 audit_inode_child(new_dentry->d_name.name, new_dentry, dir); 165 audit_inode_child(new_dentry, dir);
166 166
167 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); 167 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0);
168} 168}
@@ -176,7 +176,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
176 struct inode *d_inode = dentry->d_inode; 176 struct inode *d_inode = dentry->d_inode;
177 177
178 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode); 178 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
179 audit_inode_child(dentry->d_name.name, dentry, inode); 179 audit_inode_child(dentry, inode);
180 180
181 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 181 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
182} 182}
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index fc0f928167e7..f3a461c0970a 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1988,7 +1988,6 @@ void __audit_inode(const char *name, const struct dentry *dentry)
1988 1988
1989/** 1989/**
1990 * audit_inode_child - collect inode info for created/removed objects 1990 * audit_inode_child - collect inode info for created/removed objects
1991 * @dname: inode's dentry name
1992 * @dentry: dentry being audited 1991 * @dentry: dentry being audited
1993 * @parent: inode of dentry parent 1992 * @parent: inode of dentry parent
1994 * 1993 *
@@ -2000,13 +1999,14 @@ void __audit_inode(const char *name, const struct dentry *dentry)
2000 * must be hooked prior, in order to capture the target inode during 1999 * must be hooked prior, in order to capture the target inode during
2001 * unsuccessful attempts. 2000 * unsuccessful attempts.
2002 */ 2001 */
2003void __audit_inode_child(const char *dname, const struct dentry *dentry, 2002void __audit_inode_child(const struct dentry *dentry,
2004 const struct inode *parent) 2003 const struct inode *parent)
2005{ 2004{
2006 int idx; 2005 int idx;
2007 struct audit_context *context = current->audit_context; 2006 struct audit_context *context = current->audit_context;
2008 const char *found_parent = NULL, *found_child = NULL; 2007 const char *found_parent = NULL, *found_child = NULL;
2009 const struct inode *inode = dentry->d_inode; 2008 const struct inode *inode = dentry->d_inode;
2009 const char *dname = dentry->d_name.name;
2010 int dirlen = 0; 2010 int dirlen = 0;
2011 2011
2012 if (!context->in_syscall) 2012 if (!context->in_syscall)
@@ -2014,9 +2014,6 @@ void __audit_inode_child(const char *dname, const struct dentry *dentry,
2014 2014
2015 if (inode) 2015 if (inode)
2016 handle_one(inode); 2016 handle_one(inode);
2017 /* determine matching parent */
2018 if (!dname)
2019 goto add_names;
2020 2017
2021 /* parent is more likely, look for it first */ 2018 /* parent is more likely, look for it first */
2022 for (idx = 0; idx < context->name_count; idx++) { 2019 for (idx = 0; idx < context->name_count; idx++) {