diff options
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 28 |
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 | ||
797 | static inline void audit_free_aux(struct audit_context *context) | 793 | static 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(¤t->fs->lock); | 1693 | read_lock(¤t->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(¤t->fs->pwd); |
1702 | read_unlock(¤t->fs->lock); | 1696 | read_unlock(¤t->fs->lock); |
1703 | } | 1697 | } |
1704 | 1698 | ||