From: Zdenek Kabelac Date: Mon, 27 Feb 2012 11:23:15 +0000 (+0000) Subject: Check for vg_name existance X-Git-Tag: v2_02_96~296 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=530efdb5252903875da2248776e24d1bfd90538f;p=lvm2.git Check for vg_name existance Since vg_read() mda ops could be called with NULL vg_name, check it before derefence also for pool and format1. --- diff --git a/WHATS_NEW b/WHATS_NEW index d0bd6c939..131691799 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.94 - ==================================== + Check for existance of vg_name in _format1/_pool_vg_read(). Fix missing break in _format_pvsegs (2.02.92). Test seg pointer for non-null it in raid_target_percent error path. Check for errors in _init_tags() during config loading. diff --git a/lib/format1/format1.c b/lib/format1/format1.c index 1fac67969..f57e36398 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -186,7 +186,8 @@ static struct volume_group *_format1_vg_read(struct format_instance *fid, DM_LIST_INIT(pvs); /* Strip dev_dir if present */ - vg_name = strip_dir(vg_name, fid->fmt->cmd->dev_dir); + if (vg_name) + vg_name = strip_dir(vg_name, fid->fmt->cmd->dev_dir); if (!(vg = alloc_vg("format1_vg_read", fid->fmt->cmd, NULL))) return_NULL; diff --git a/lib/format_pool/format_pool.c b/lib/format_pool/format_pool.c index 8731e9563..08b59aa2e 100644 --- a/lib/format_pool/format_pool.c +++ b/lib/format_pool/format_pool.c @@ -110,7 +110,8 @@ static struct volume_group *_pool_vg_read(struct format_instance *fid, /* We can safely ignore the mda passed in */ /* Strip dev_dir if present */ - vg_name = strip_dir(vg_name, fid->fmt->cmd->dev_dir); + if (vg_name) + vg_name = strip_dir(vg_name, fid->fmt->cmd->dev_dir); /* Set vg_name through read_pool_pds() */ if (!(vg = alloc_vg("pool_vg_read", fid->fmt->cmd, NULL)))