Commit 23d8f5b6 authored by Al Viro's avatar Al Viro

make dump_common_audit_data() safe to be called from RCU pathwalk

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent bca585d2
...@@ -291,18 +291,19 @@ static void dump_common_audit_data(struct audit_buffer *ab, ...@@ -291,18 +291,19 @@ static void dump_common_audit_data(struct audit_buffer *ab,
struct dentry *dentry; struct dentry *dentry;
struct inode *inode; struct inode *inode;
rcu_read_lock();
inode = a->u.inode; inode = a->u.inode;
dentry = d_find_alias(inode); dentry = d_find_alias_rcu(inode);
if (dentry) { if (dentry) {
audit_log_format(ab, " name="); audit_log_format(ab, " name=");
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
audit_log_untrustedstring(ab, dentry->d_name.name); audit_log_untrustedstring(ab, dentry->d_name.name);
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
dput(dentry);
} }
audit_log_format(ab, " dev="); audit_log_format(ab, " dev=");
audit_log_untrustedstring(ab, inode->i_sb->s_id); audit_log_untrustedstring(ab, inode->i_sb->s_id);
audit_log_format(ab, " ino=%lu", inode->i_ino); audit_log_format(ab, " ino=%lu", inode->i_ino);
rcu_read_unlock();
break; break;
} }
case LSM_AUDIT_DATA_TASK: { case LSM_AUDIT_DATA_TASK: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment