Skip to content

Commit

Permalink
autofs: fix use-after-free in lockless ->d_manage()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Al Viro committed Apr 9, 2019
1 parent 5467a68 commit ce285c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions fs/autofs/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct autofs_info {

kuid_t uid;
kgid_t gid;
struct rcu_head rcu;
};

#define AUTOFS_INF_EXPIRING (1<<0) /* dentry in the process of expiring */
Expand Down
2 changes: 1 addition & 1 deletion fs/autofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void autofs_clean_ino(struct autofs_info *ino)

void autofs_free_ino(struct autofs_info *ino)
{
kfree(ino);
kfree_rcu(ino, rcu);
}

void autofs_kill_sb(struct super_block *sb)
Expand Down

0 comments on commit ce285c2

Please sign in to comment.