[Ocfs2-tools-devel] [PATCH]debugfs.ocfs2: fix segmentation fault in do_slotmap()

Tao Ma tao.ma at oracle.com
Tue May 20 23:46:59 PDT 2008


Ack-by: Tao Ma <tao.ma at oracle.com>

btw, your patch seems to be based on the stack-user branch of 
ocfs2-tools, not the master. So please say it next time since I have 
spent some time to find out your code base. ;) And I have added Joel to 
the cc list since now the branch is taken care of by him.

Regards,
Tao

Coly Li wrote:
> In do_slotmap(), avoid accessing super block info before calling check_device_open(), otherwise, a
> SIGSEG will come.
> 
> Signed-off-by: Coly Li <coyli at suse.de>
> ---
> 
> diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
> index de9bc7e..bfcda4e 100644
> --- a/debugfs.ocfs2/commands.c
> +++ b/debugfs.ocfs2/commands.c
> @@ -1203,13 +1203,14 @@ static void do_slotmap (char **args)
>  {
>  	FILE *out;
>  	errcode_t ret;
> -	int num_slots = OCFS2_RAW_SB(gbls.fs->fs_super)->s_max_slots;
> +	int num_slots;
>  	struct ocfs2_slot_map_extended *se = NULL;
>  	struct ocfs2_slot_map *sm = NULL;
> 
>  	if (check_device_open())
>  		return ;
> 
> +	num_slots = OCFS2_RAW_SB(gbls.fs->fs_super)->s_max_slots;
>  	if (ocfs2_uses_extended_slot_map(OCFS2_RAW_SB(gbls.fs->fs_super)))
>  		ret = ocfs2_read_slot_map_extended(gbls.fs, num_slots, &se);
>  	else
> 
> 



More information about the Ocfs2-tools-devel mailing list