[lvm-devel] [PATCH 1/1] Fix use of vgname and vgid

Alasdair G Kergon agk at redhat.com
Wed Apr 20 21:36:30 UTC 2011


On Wed, Apr 20, 2011 at 02:37:07PM +0200, Zdenek Kabelac wrote:
> As get_pv_from_vg_by_id() may call lvmcache_label_scan() keep the vgname
> and vgid copied localy on the stack as vginfo may dissapear and code was
> then accessing garbage in memory.
 
Currently, vginfo structs must not be held across calls to vg_read (or used as
parameters).

Have you audited the code to check there are no similar problems elsewhere?

I'm not too happy with the workaround in this patch, but it'll do for now,
as a proper fix would take quite a bit longer to develop.

> +		/*
> +		 * get_pv_from_vg_by_id() may lead to
> +		 * lvmcache_label_scan() so it can drop
> +		 * vginfo and all referenced data.
> +		 */

Document the restriction I mentioned above at the vg_read* entry point.

Alasdair




More information about the lvm-devel mailing list