Skip to content

Commit

Permalink
configfs: call drop_link() to cleanup after create_link() failure
Browse files Browse the repository at this point in the history
When allow_link() succeeds but create_link() fails, the subsystem is not
informed of the failure.

This patch fixes this by calling drop_link() on create_link() failures.

Signed-off-by: Louis Rilling <Louis.Rilling@kerlabs.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
  • Loading branch information
Louis Rilling authored and Mark Fasheh committed Jul 14, 2008
1 parent 11c3b79 commit e752065
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/configfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
goto out_put;

ret = type->ct_item_ops->allow_link(parent_item, target_item);
if (!ret)
if (!ret) {
ret = create_link(parent_item, target_item, dentry);
if (ret && type->ct_item_ops->drop_link)
type->ct_item_ops->drop_link(parent_item,
target_item);
}

config_item_put(target_item);
path_put(&nd.path);
Expand Down

0 comments on commit e752065

Please sign in to comment.