Skip to content

Commit

Permalink
Merge tag 'configfs-for-5.2' of git://git.infradead.org/users/hch/con…
Browse files Browse the repository at this point in the history
…figfs

Pull configfs update from Christoph Hellwig:

 - a fix for an error path use after free (YueHaibing)

* tag 'configfs-for-5.2' of git://git.infradead.org/users/hch/configfs:
  configfs: fix possible use-after-free in configfs_register_group
  • Loading branch information
torvalds committed May 16, 2019
2 parents 27ebbf9 + 35399f8 commit 4e785e8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions fs/configfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1757,12 +1757,19 @@ int configfs_register_group(struct config_group *parent_group,

inode_lock_nested(d_inode(parent), I_MUTEX_PARENT);
ret = create_default_group(parent_group, group);
if (!ret) {
spin_lock(&configfs_dirent_lock);
configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata);
spin_unlock(&configfs_dirent_lock);
}
if (ret)
goto err_out;

spin_lock(&configfs_dirent_lock);
configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata);
spin_unlock(&configfs_dirent_lock);
inode_unlock(d_inode(parent));
return 0;
err_out:
inode_unlock(d_inode(parent));
mutex_lock(&subsys->su_mutex);
unlink_group(group);
mutex_unlock(&subsys->su_mutex);
return ret;
}
EXPORT_SYMBOL(configfs_register_group);
Expand Down

0 comments on commit 4e785e8

Please sign in to comment.