diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 15:25:23 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 00:32:01 -0400 |
commit | bfcec7087458812f575d9022b2d151641f34ee84 (patch) | |
tree | 6c0f7dd3b016992da8d113ceeaae404c6abc03a1 /ipc | |
parent | 78e2e802a8519031e5858595070b39713e26340d (diff) |
audit: set the name_len in audit_inode for parent lookups
Currently, this gets set mostly by happenstance when we call into
audit_inode_child. While that might be a little more efficient, it seems
wrong. If the syscall ends up failing before audit_inode_child ever gets
called, then you'll have an audit_names record that shows the full path
but has the parent inode info attached.
Fix this by passing in a parent flag when we call audit_inode that gets
set to the value of LOOKUP_PARENT. We can then fix up the pathname for
the audit entry correctly from the get-go.
While we're at it, clean up the no-op macro for audit_inode in the
!CONFIG_AUDITSYSCALL case.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/mqueue.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 6b97e2466fad..9553ed006042 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -804,7 +804,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
804 | 804 | ||
805 | if (oflag & O_CREAT) { | 805 | if (oflag & O_CREAT) { |
806 | if (path.dentry->d_inode) { /* entry already exists */ | 806 | if (path.dentry->d_inode) { /* entry already exists */ |
807 | audit_inode(name, path.dentry); | 807 | audit_inode(name, path.dentry, 0); |
808 | if (oflag & O_EXCL) { | 808 | if (oflag & O_EXCL) { |
809 | error = -EEXIST; | 809 | error = -EEXIST; |
810 | goto out; | 810 | goto out; |
@@ -824,7 +824,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
824 | error = -ENOENT; | 824 | error = -ENOENT; |
825 | goto out; | 825 | goto out; |
826 | } | 826 | } |
827 | audit_inode(name, path.dentry); | 827 | audit_inode(name, path.dentry, 0); |
828 | filp = do_open(&path, oflag); | 828 | filp = do_open(&path, oflag); |
829 | } | 829 | } |
830 | 830 | ||
@@ -978,7 +978,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
978 | goto out_fput; | 978 | goto out_fput; |
979 | } | 979 | } |
980 | info = MQUEUE_I(inode); | 980 | info = MQUEUE_I(inode); |
981 | audit_inode(NULL, f.file->f_path.dentry); | 981 | audit_inode(NULL, f.file->f_path.dentry, 0); |
982 | 982 | ||
983 | if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { | 983 | if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { |
984 | ret = -EBADF; | 984 | ret = -EBADF; |
@@ -1094,7 +1094,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1094 | goto out_fput; | 1094 | goto out_fput; |
1095 | } | 1095 | } |
1096 | info = MQUEUE_I(inode); | 1096 | info = MQUEUE_I(inode); |
1097 | audit_inode(NULL, f.file->f_path.dentry); | 1097 | audit_inode(NULL, f.file->f_path.dentry, 0); |
1098 | 1098 | ||
1099 | if (unlikely(!(f.file->f_mode & FMODE_READ))) { | 1099 | if (unlikely(!(f.file->f_mode & FMODE_READ))) { |
1100 | ret = -EBADF; | 1100 | ret = -EBADF; |