diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-02-23 00:05:30 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-02-23 00:05:30 +0300 |
commit | 250a25e7a1d71da06213aa354ece44fb8faa73f7 (patch) | |
tree | 53bce39e79d1501eb275b5ad3ff780f009894db1 /security | |
parent | 205f92d7f2106fb248d65d2abce943ed6002598f (diff) | |
parent | 23d8f5b684fc30126b7708cad38b753eaa078b3e (diff) | |
download | linux-250a25e7a1d71da06213aa354ece44fb8faa73f7.tar.xz |
Merge branch 'work.audit' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull RCU-safe common_lsm_audit() from Al Viro:
"Make common_lsm_audit() non-blocking and usable from RCU pathwalk
context.
We don't really need to grab/drop dentry in there - rcu_read_lock() is
enough. There's a couple of followups using that to simplify the
logics in selinux, but those hadn't soaked in -next yet, so they'll
have to go in next window"
* 'work.audit' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
make dump_common_audit_data() safe to be called from RCU pathwalk
new helper: d_find_alias_rcu()
Diffstat (limited to 'security')
-rw-r--r-- | security/lsm_audit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/security/lsm_audit.c b/security/lsm_audit.c index a0cd28cd31a8..82ce14933513 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c @@ -291,18 +291,19 @@ static void dump_common_audit_data(struct audit_buffer *ab, struct dentry *dentry; struct inode *inode; + rcu_read_lock(); inode = a->u.inode; - dentry = d_find_alias(inode); + dentry = d_find_alias_rcu(inode); if (dentry) { audit_log_format(ab, " name="); spin_lock(&dentry->d_lock); audit_log_untrustedstring(ab, dentry->d_name.name); spin_unlock(&dentry->d_lock); - dput(dentry); } audit_log_format(ab, " dev="); audit_log_untrustedstring(ab, inode->i_sb->s_id); audit_log_format(ab, " ino=%lu", inode->i_ino); + rcu_read_unlock(); break; } case LSM_AUDIT_DATA_TASK: { |