]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - kernel/auditsc.c
Merge branch 'upstream' of git://git.infradead.org/users/pcmoore/audit
[mirror_ubuntu-zesty-kernel.git] / kernel / auditsc.c
index 9b56b7ae053fb5c23a359fd27cfcb25120c05107..b86cc04959dee64ac1972a28fd35acddae85e94b 100644 (file)
@@ -1024,8 +1024,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
         * for strings that are too long, we should not have created
         * any.
         */
-       if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
-               WARN_ON(1);
+       if (WARN_ON_ONCE(len < 0 || len > MAX_ARG_STRLEN - 1)) {
                send_sig(SIGKILL, current, 0);
                return -1;
        }
@@ -1630,7 +1629,7 @@ retry:
        rcu_read_lock();
        seq = read_seqbegin(&rename_lock);
        for(;;) {
-               struct inode *inode = d->d_inode;
+               struct inode *inode = d_backing_inode(d);
                if (inode && unlikely(!hlist_empty(&inode->i_fsnotify_marks))) {
                        struct audit_chunk *chunk;
                        chunk = audit_tree_lookup(inode);
@@ -1755,7 +1754,7 @@ void __audit_inode(struct filename *name, const struct dentry *dentry,
                   unsigned int flags)
 {
        struct audit_context *context = current->audit_context;
-       const struct inode *inode = dentry->d_inode;
+       const struct inode *inode = d_backing_inode(dentry);
        struct audit_names *n;
        bool parent = flags & AUDIT_INODE_PARENT;
 
@@ -1854,7 +1853,7 @@ void __audit_inode_child(const struct inode *parent,
                         const unsigned char type)
 {
        struct audit_context *context = current->audit_context;
-       const struct inode *inode = dentry->d_inode;
+       const struct inode *inode = d_backing_inode(dentry);
        const char *dname = dentry->d_name.name;
        struct audit_names *n, *found_parent = NULL, *found_child = NULL;
 
@@ -2362,7 +2361,6 @@ static void audit_log_task(struct audit_buffer *ab)
        kuid_t auid, uid;
        kgid_t gid;
        unsigned int sessionid;
-       struct mm_struct *mm = current->mm;
        char comm[sizeof(current->comm)];
 
        auid = audit_get_loginuid(current);
@@ -2377,13 +2375,7 @@ static void audit_log_task(struct audit_buffer *ab)
        audit_log_task_context(ab);
        audit_log_format(ab, " pid=%d comm=", task_pid_nr(current));
        audit_log_untrustedstring(ab, get_task_comm(comm, current));
-       if (mm) {
-               down_read(&mm->mmap_sem);
-               if (mm->exe_file)
-                       audit_log_d_path(ab, " exe=", &mm->exe_file->f_path);
-               up_read(&mm->mmap_sem);
-       } else
-               audit_log_format(ab, " exe=(null)");
+       audit_log_d_path_exe(ab, current->mm);
 }
 
 /**