btrfs-progs: handle errors in get_inode_backref and fail in the caller
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f72a3f9f9f
commit
b317ca97d3
1 changed files with 3 additions and 0 deletions
|
@ -952,6 +952,8 @@ static struct inode_backref *get_inode_backref(struct inode_record *rec,
|
|||
}
|
||||
|
||||
backref = malloc(sizeof(*backref) + namelen + 1);
|
||||
if (!backref)
|
||||
return NULL;
|
||||
memset(backref, 0, sizeof(*backref));
|
||||
backref->dir = dir;
|
||||
backref->namelen = namelen;
|
||||
|
@ -972,6 +974,7 @@ static int add_inode_backref(struct cache_tree *inode_cache,
|
|||
rec = get_inode_rec(inode_cache, ino, 1);
|
||||
BUG_ON(IS_ERR(rec));
|
||||
backref = get_inode_backref(rec, name, namelen, dir);
|
||||
BUG_ON(!backref);
|
||||
if (errors)
|
||||
backref->errors |= errors;
|
||||
if (itemtype == BTRFS_DIR_INDEX_KEY) {
|
||||
|
|
Loading…
Reference in a new issue