1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib
Zdenek Kabelac b680d5bf7b Fix use of released vgname and vgid
Avoid using of already released memory when duplicated MDA is found.

As get_pv_from_vg_by_id() may call lvmcache_label_scan() use the local copy
of the vgname and vgid on the stack as vginfo may dissapear and code was
then accessing garbage in memory.

i.e.  pvs  /dev/loop0
(when /dev/loop0 and /dev/loop1 has same MDA content)

Invalid read of size 1
   at 0x523C986: dm_hash_lookup (hash.c:325)
   by 0x440C8C: vginfo_from_vgname (lvmcache.c:399)
   by 0x4605C0: _create_vg_text_instance (format-text.c:1882)
   by 0x46140D: _text_create_text_instance (format-text.c:2243)
   by 0x47EB49: _vg_read (metadata.c:2887)
   by 0x47FBD8: vg_read_internal (metadata.c:3231)
   by 0x477594: get_pv_from_vg_by_id (metadata.c:344)
   by 0x45F07A: _get_pv_if_in_vg (format-text.c:1400)
   by 0x45F0B9: _populate_pv_fields (format-text.c:1414)
   by 0x45F40F: _text_pv_read (format-text.c:1493)
   by 0x480431: _pv_read (metadata.c:3500)
   by 0x4802B2: pv_read (metadata.c:3462)
 Address 0x652ab80 is 0 bytes inside a block of size 4 free'd
   at 0x4C2756E: free (vg_replace_malloc.c:366)
   by 0x442277: _free_vginfo (lvmcache.c:963)
   by 0x44235E: _drop_vginfo (lvmcache.c:992)
   by 0x442B23: _lvmcache_update_vgname (lvmcache.c:1165)
   by 0x443449: lvmcache_update_vgname_and_id (lvmcache.c:1358)
   by 0x443C07: lvmcache_add (lvmcache.c:1492)
   by 0x46588C: _text_read (text_label.c:271)
   by 0x466A65: label_read (label.c:289)
   by 0x4413FC: lvmcache_label_scan (lvmcache.c:635)
   by 0x4605AD: _create_vg_text_instance (format-text.c:1881)
   by 0x46140D: _text_create_text_instance (format-text.c:2243)
   by 0x47EB49: _vg_read (metadata.c:2887)

Add testing script
2011-04-21 13:13:40 +00:00
..
activate Fix some unmatching sign comparation gcc warnings 2011-04-08 14:40:18 +00:00
cache Keep the cache content when the exported vg buffer is matching 2011-03-30 13:14:34 +00:00
commands Replace PV_MIN_SIZE with function pv_min_size() 2011-02-18 14:11:22 +00:00
config Add "devices/issue_discards" to lvm.conf. 2011-04-12 21:59:01 +00:00
datastruct Better const cast logic 2011-04-08 14:14:57 +00:00
device Add "devices/issue_discards" to lvm.conf. 2011-04-12 21:59:01 +00:00
display Fix some compile warnings on RHEL5 2011-03-01 20:17:56 +00:00
error Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
filters Const fixing 2011-02-18 14:47:28 +00:00
format1 Fix reading of unitialized memory 2011-03-30 12:30:39 +00:00
format_pool Use format instance mempool where possible and adequate. 2011-03-11 15:10:16 +00:00
format_text Fix use of released vgname and vgid 2011-04-21 13:13:40 +00:00
freeseg Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
label Add dm_zalloc and use it and dm_pool_zalloc throughout. 2010-09-30 21:06:50 +00:00
locking Fix some unmatching sign comparation gcc warnings 2011-04-08 14:40:18 +00:00
log Fix some forgotten -Wold-style-definition gcc warnings 2011-04-08 14:13:08 +00:00
metadata Fix use of released vgname and vgid 2011-04-21 13:13:40 +00:00
mirror Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
misc Fix some unmatching sign comparation gcc warnings 2011-04-08 14:40:18 +00:00
mm Fix some unmatching sign comparation gcc warnings 2011-04-08 14:40:18 +00:00
replicator Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
report This patchset refactors some reporting code and completes the remaining 2011-04-12 12:24:29 +00:00
snapshot Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
striped Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
unknown Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
uuid Const fixing 2011-02-18 14:47:28 +00:00
zero Replace malloc with zalloc when creating segment_type's 2011-03-25 21:59:42 +00:00
Makefile.in Refactor the percent (mirror sync, snapshot usage) handling code to use 2010-11-30 11:53:31 +00:00