[Ocfs2-tools-devel] [PATCH RESEND] libocfs2: fix segfalut BUG while doing fsck

Eric Ren zren at suse.com
Thu Mar 3 20:49:07 PST 2016



On 03/03/2016 06:58 PM, Joseph Qi wrote:
> From: Norton.Zhu <norton.zhu at huawei.com>
>
> This happens while finishing ocfs2_bitmap_merge_region with root node
> colored RED (only one node in the tree).
> After another node adds in and do rb_insert_color, segfault occurs
> because of NULL pointer.
>
> Signed-off-by: Norton.Zhu <norton.zhu at huawei.com>
> Reviewed-by: Jun Piao <piaojun at huawei.com>
> Signed-off-by: Joseph Qi <joseph.qi at huawei.com>

Reviewed-by: Eric Ren<zren at suse.com>

> ---
>   libocfs2/kernel-rbtree.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/libocfs2/kernel-rbtree.c b/libocfs2/kernel-rbtree.c
> index 1c8f911..629d472 100644
> --- a/libocfs2/kernel-rbtree.c
> +++ b/libocfs2/kernel-rbtree.c
> @@ -77,6 +77,8 @@ void rb_insert_color(struct rb_node *node, struct rb_root *root)
>   	while ((parent = node->rb_parent) && parent->rb_color == RB_RED)
>   	{
>   		gparent = parent->rb_parent;
> +		if (!gparent)
> +			break;
>
>   		if (parent == gparent->rb_left)
>   		{




More information about the Ocfs2-tools-devel mailing list