Skip to content

Commit ce285c2

Browse files
author
Al Viro
committed
autofs: fix use-after-free in lockless ->d_manage()
autofs_d_release() can overlap with lockless ->d_manage(), ending up with autofs_dentry_ino() freed under the latter. Make freeing autofs_info instances RCU-delayed... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 5467a68 commit ce285c2

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/autofs/autofs_i.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct autofs_info {
7171

7272
kuid_t uid;
7373
kgid_t gid;
74+
struct rcu_head rcu;
7475
};
7576

7677
#define AUTOFS_INF_EXPIRING (1<<0) /* dentry in the process of expiring */

‎fs/autofs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void autofs_clean_ino(struct autofs_info *ino)
3636

3737
void autofs_free_ino(struct autofs_info *ino)
3838
{
39-
kfree(ino);
39+
kfree_rcu(ino, rcu);
4040
}
4141

4242
void autofs_kill_sb(struct super_block *sb)

0 commit comments

Comments
 (0)