aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-14 22:38:33 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-15 00:17:08 -0500
commit44707fdf5938ad269ea5d6c5744d82f6a7328746 (patch)
tree7eb1704418eb41b859ad24bc48f6400135474d87 /kernel/auditsc.c
parenta03a8a709a0c34b61b7aea1d54a0473a6b941fdb (diff)
d_path: Use struct path in struct avc_audit_data
audit_log_d_path() is a d_path() wrapper that is used by the audit code. To use a struct path in audit_log_d_path() I need to embed it into struct avc_audit_data. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Jan Blunck <jblunck@suse.de> Acked-by: Christoph Hellwig <hch@infradead.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Neil Brown <neilb@suse.de> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 741291a1de0d..ac6d9b23b018 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -208,8 +208,7 @@ struct audit_context {
208 int name_count; 208 int name_count;
209 struct audit_names names[AUDIT_NAMES]; 209 struct audit_names names[AUDIT_NAMES];
210 char * filterkey; /* key for rule that triggered record */ 210 char * filterkey; /* key for rule that triggered record */
211 struct dentry * pwd; 211 struct path pwd;
212 struct vfsmount * pwdmnt;
213 struct audit_context *previous; /* For nested syscalls */ 212 struct audit_context *previous; /* For nested syscalls */
214 struct audit_aux_data *aux; 213 struct audit_aux_data *aux;
215 struct audit_aux_data *aux_pids; 214 struct audit_aux_data *aux_pids;
@@ -786,12 +785,9 @@ static inline void audit_free_names(struct audit_context *context)
786 __putname(context->names[i].name); 785 __putname(context->names[i].name);
787 } 786 }
788 context->name_count = 0; 787 context->name_count = 0;
789 if (context->pwd) 788 path_put(&context->pwd);
790 dput(context->pwd); 789 context->pwd.dentry = NULL;
791 if (context->pwdmnt) 790 context->pwd.mnt = NULL;
792 mntput(context->pwdmnt);
793 context->pwd = NULL;
794 context->pwdmnt = NULL;
795} 791}
796 792
797static inline void audit_free_aux(struct audit_context *context) 793static inline void audit_free_aux(struct audit_context *context)
@@ -930,8 +926,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk
930 if ((vma->vm_flags & VM_EXECUTABLE) && 926 if ((vma->vm_flags & VM_EXECUTABLE) &&
931 vma->vm_file) { 927 vma->vm_file) {
932 audit_log_d_path(ab, "exe=", 928 audit_log_d_path(ab, "exe=",
933 vma->vm_file->f_path.dentry, 929 &vma->vm_file->f_path);
934 vma->vm_file->f_path.mnt);
935 break; 930 break;
936 } 931 }
937 vma = vma->vm_next; 932 vma = vma->vm_next;
@@ -1341,10 +1336,10 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1341 context->target_sid, context->target_comm)) 1336 context->target_sid, context->target_comm))
1342 call_panic = 1; 1337 call_panic = 1;
1343 1338
1344 if (context->pwd && context->pwdmnt) { 1339 if (context->pwd.dentry && context->pwd.mnt) {
1345 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD); 1340 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);
1346 if (ab) { 1341 if (ab) {
1347 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt); 1342 audit_log_d_path(ab, "cwd=", &context->pwd);
1348 audit_log_end(ab); 1343 audit_log_end(ab);
1349 } 1344 }
1350 } 1345 }
@@ -1367,8 +1362,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1367 case 0: 1362 case 0:
1368 /* name was specified as a relative path and the 1363 /* name was specified as a relative path and the
1369 * directory component is the cwd */ 1364 * directory component is the cwd */
1370 audit_log_d_path(ab, " name=", context->pwd, 1365 audit_log_d_path(ab, " name=", &context->pwd);
1371 context->pwdmnt);
1372 break; 1366 break;
1373 default: 1367 default:
1374 /* log the name's directory component */ 1368 /* log the name's directory component */
@@ -1695,10 +1689,10 @@ void __audit_getname(const char *name)
1695 context->names[context->name_count].ino = (unsigned long)-1; 1689 context->names[context->name_count].ino = (unsigned long)-1;
1696 context->names[context->name_count].osid = 0; 1690 context->names[context->name_count].osid = 0;
1697 ++context->name_count; 1691 ++context->name_count;
1698 if (!context->pwd) { 1692 if (!context->pwd.dentry) {
1699 read_lock(&current->fs->lock); 1693 read_lock(&current->fs->lock);
1700 context->pwd = dget(current->fs->pwd.dentry); 1694 context->pwd = current->fs->pwd;
1701 context->pwdmnt = mntget(current->fs->pwd.mnt); 1695 path_get(&current->fs->pwd);
1702 read_unlock(&current->fs->lock); 1696 read_unlock(&current->fs->lock);
1703 } 1697 }
1704 1698