Linux 6.9-rc1
[linux-2.6-microblaze.git] / kernel / audit_watch.c
index 4b0957a..7a98cd1 100644 (file)
@@ -133,7 +133,7 @@ int audit_watch_compare(struct audit_watch *watch, unsigned long ino, dev_t dev)
 }
 
 /* Initialize a parent watch entry. */
-static struct audit_parent *audit_init_parent(struct path *path)
+static struct audit_parent *audit_init_parent(const struct path *path)
 {
        struct inode *inode = d_backing_inode(path->dentry);
        struct audit_parent *parent;
@@ -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 (!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);
 }