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

Joseph Qi joseph.qi at huawei.com
Thu Aug 6 23:30:53 PDT 2015


On 2015/8/7 14:00, Norton.Zhu wrote:
> Fix rb_insert_color segfault BUG
> This happens while finishing ocfs2_bitmap_merge_region
> with root node colored RED(only one node in the tree)
> After another node add in and do rb_insert_color,
> segfault occurred(NULL pointer).
> 
> Signed-off-by: Norton.Zhu <norton.zhu at huawei.com>
> Reviewed-by: Jun Piao <piaojun at huawei.com>
Reviewed-by: Joseph Qi <joseph.qi at huawei.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