Merge tag 'audit-pr-20180403' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoor...
[linux-2.6-microblaze.git] / fs / namei.c
index a094193..a66ed5a 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/bitops.h>
 #include <linux/init_task.h>
 #include <linux/uaccess.h>
+#include <linux/build_bug.h>
 
 #include "internal.h"
 #include "mount.h"
@@ -130,6 +131,7 @@ getname_flags(const char __user *filename, int flags, int *empty)
        struct filename *result;
        char *kname;
        int len;
+       BUILD_BUG_ON(offsetof(struct filename, iname) % sizeof(long) != 0);
 
        result = audit_reusename(filename);
        if (result)
@@ -927,7 +929,8 @@ static inline int may_follow_link(struct nameidata *nd)
        if (nd->flags & LOOKUP_RCU)
                return -ECHILD;
 
-       audit_log_link_denied("follow_link", &nd->stack[0].link);
+       audit_inode(nd->name, nd->stack[0].link.dentry, 0);
+       audit_log_link_denied("follow_link");
        return -EACCES;
 }
 
@@ -993,7 +996,7 @@ static int may_linkat(struct path *link)
        if (safe_hardlink_source(inode) || inode_owner_or_capable(inode))
                return 0;
 
-       audit_log_link_denied("linkat", link);
+       audit_log_link_denied("linkat");
        return -EPERM;
 }
 
@@ -3374,9 +3377,7 @@ finish_open_created:
                goto out;
        *opened |= FILE_OPENED;
 opened:
-       error = open_check_o_direct(file);
-       if (!error)
-               error = ima_file_check(file, op->acc_mode, *opened);
+       error = ima_file_check(file, op->acc_mode, *opened);
        if (!error && will_truncate)
                error = handle_truncate(file);
 out:
@@ -3456,9 +3457,6 @@ static int do_tmpfile(struct nameidata *nd, unsigned flags,
        error = finish_open(file, child, NULL, opened);
        if (error)
                goto out2;
-       error = open_check_o_direct(file);
-       if (error)
-               fput(file);
 out2:
        mnt_drop_write(path.mnt);
 out: