• Josef Bacik's avatar
    btrfs: fixup error handling in fixup_inode_link_counts · 011b28ac
    Josef Bacik authored
    This function has the following pattern
    
    	while (1) {
    		ret = whatever();
    		if (ret)
    			goto out;
    	}
    	ret = 0
    out:
    	return ret;
    
    However several places in this while loop we simply break; when there's
    a problem, thus clearing the return value, and in one case we do a
    return -EIO, and leak the memory for the path.
    
    Fix this by re-arranging the loop to deal with ret == 1 coming from
    btrfs_search_slot, and then simply delete the
    
    	ret = 0;
    out:
    
    bit so everybody can break if there is an error, which will allow for
    proper error handling to occur.
    
    CC: stable@vger.kernel.org # 4.4+
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    011b28ac
tree-log.c 175 KB