• Josef Bacik's avatar
    btrfs: fix uninitialized parent in insert_state · d7c9e1be
    Josef Bacik authored
    I don't know how this isn't caught when we build this in the kernel, but
    while syncing extent-io-tree.c into btrfs-progs I got an error because
    parent could potentially be uninitialized when we link in a new node,
    specifically when the extent_io_tree is empty.  This means we could have
    garbage in the parent color.  I don't know what the ramifications are of
    that, but it's probably not great, so fix this by initializing parent to
    NULL.  I spot checked all of our other usages in btrfs and we appear to
    be doing the correct thing everywhere else.
    
    Fixes: c7e118cf ("btrfs: open code rbtree search in insert_state")
    CC: stable@vger.kernel.org # 6.0+
    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>
    d7c9e1be
extent-io-tree.c 45.7 KB