audit: don't take task_lock() in audit_exe_compare() code path
[linux-2.6-block.git] / kernel / audit_watch.c
index 65075f1e4ac8c8751b639bff2d7b66f79c6a7dec..91e82e34b51e328eed868e025a5873fd6f557534 100644 (file)
@@ -527,11 +527,18 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
        unsigned long ino;
        dev_t dev;
 
-       exe_file = get_task_exe_file(tsk);
+       /* only do exe filtering if we are recording @current events/records */
+       if (tsk != current)
+               return 0;
+
+       if (WARN_ON_ONCE(!current->mm))
+               return 0;
+       exe_file = get_mm_exe_file(current->mm);
        if (!exe_file)
                return 0;
        ino = file_inode(exe_file)->i_ino;
        dev = file_inode(exe_file)->i_sb->s_dev;
        fput(exe_file);
+
        return audit_mark_compare(mark, ino, dev);
 }