[lvm2/f19] Fix release of PV's fid in free_pv_fid().

Peter Rajnoha prajnoha at fedoraproject.org
Tue Nov 25 10:24:15 UTC 2014


commit 25edbdf6015ba341f95cdb45f77e5e8e2aace879
Author: Peter Rajnoha <prajnoha at redhat.com>
Date:   Tue Nov 25 11:23:06 2014 +0100

    Fix release of PV's fid in free_pv_fid().
    
    Resolves: #1167504

 ...2_99-fix-release-of-pv-fix-in-free_pv_fid.patch |   30 ++++++++++++++++++++
 lvm2.spec                                          |    7 ++++-
 2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/lvm2-2_02_99-fix-release-of-pv-fix-in-free_pv_fid.patch b/lvm2-2_02_99-fix-release-of-pv-fix-in-free_pv_fid.patch
new file mode 100644
index 0000000..7daf498
--- /dev/null
+++ b/lvm2-2_02_99-fix-release-of-pv-fix-in-free_pv_fid.patch
@@ -0,0 +1,30 @@
+ WHATS_NEW               | 1 +
+ lib/metadata/metadata.c | 3 +--
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index 920289d..5291aaa 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -27,6 +27,7 @@ Version 2.02.100 -
+ 
+ Version 2.02.99 - 
+ ===================================
++  Fix release of PV's fid in free_pv_fid().
+   Check lvmcache_info_from_pvid and recall only when needed in _pv_read.
+   Fix lvmetad error path in lvmetad_vg_lookup() for null vgname.
+   Fix use of too big chunks of memory when communication with lvmetad.
+diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
+index d4ee8fd..c2f9d1c 100644
+--- a/lib/metadata/metadata.c
++++ b/lib/metadata/metadata.c
+@@ -3436,8 +3436,7 @@ void free_pv_fid(struct physical_volume *pv)
+ 	if (!pv)
+ 		return;
+ 
+-	if (pv->fid)
+-		pv->fid->fmt->ops->destroy_instance(pv->fid);
++	pv_set_fid(pv, NULL);
+ }
+ 
+ /* This is only called by lv_from_lvid, which is only called from
diff --git a/lvm2.spec b/lvm2.spec
index 77fb7c0..3e885ac 100644
--- a/lvm2.spec
+++ b/lvm2.spec
@@ -37,7 +37,7 @@
 Summary: Userland logical volume management tools 
 Name: lvm2
 Version: 2.02.98
-Release: 15%{?dist}
+Release: 16%{?dist}
 License: GPLv2
 Group: System Environment/Base
 URL: http://sources.redhat.com/lvm2
@@ -85,6 +85,7 @@ Patch39: lvm2-2_02_105-lvm2app-save-off-and-restore-umask-values.patch
 Patch40: lvm2-2_02_99-check-lvmcache_info_from_pvid-and-recall-only-when-needed-in-pv_read.patch
 Patch41: lvm2-2_02_103-add-ignoreskippedcluster-arg-for-exit-status-success-when-clustered-VGs-skipped.patch
 Patch42: lvm2-2_02_106-add-support-for-partitions-on-ZFS-zvol.patch
+Patch43: lvm2-2_02_99-fix-release-of-pv-fix-in-free_pv_fid.patch
 
 BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
 BuildRequires: ncurses-devel
@@ -162,6 +163,7 @@ or more physical volumes and creating one or more logical volumes
 %patch40 -p1 -b .lvmcache_info_pvread
 %patch41 -p1 -b .ignoreskippedcluster
 %patch42 -p1 -b .zfs_zvol
+%patch43 -p1 -b .free_pv_fid
 
 %build
 %define _default_pid_dir /run
@@ -655,6 +657,9 @@ the device-mapper event library.
 %{_libdir}/pkgconfig/devmapper-event.pc
 
 %changelog
+* Tue Nov 25 2014 Peter Rajnoha <prajnoha at redhat.com> - 2.02.98-16
+- Fix release of PV's fid in free_pv_fid() causing double free of memory.
+
 * Mon Feb 17 2014 Peter Rajnoha <prajnoha at redhat.com> - 2.02.98-15
 - Add support for partitions on ZFS zvol.
 - Add --ignoreskippedcluster for exit status success when clustered VGs skipped.


More information about the scm-commits mailing list