Skip to content

Commit

Permalink
ubifs: fix use-after-free on symlink traversal
Browse files Browse the repository at this point in the history
free the symlink body after the same RCU delay we have for freeing the
struct inode itself, so that traversal during RCU pathwalk wouldn't step
into freed memory.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Apr 1, 2019
1 parent 4fdcfab commit 0cdc17e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,12 @@ static void ubifs_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
struct ubifs_inode *ui = ubifs_inode(inode);
kfree(ui->data);
kmem_cache_free(ubifs_inode_slab, ui);
}

static void ubifs_destroy_inode(struct inode *inode)
{
struct ubifs_inode *ui = ubifs_inode(inode);

kfree(ui->data);
call_rcu(&inode->i_rcu, ubifs_i_callback);
}

Expand Down

0 comments on commit 0cdc17e

Please sign in to comment.