fix memleaks on list removal
(cherry picked from commit 715ac101c882fde8fa55b2558254ce8cc7f6529b)
This commit is contained in:
parent
3cb62dcdf4
commit
b9858e307a
70
0021-lvmcache-fix-memleaks-on-list-removal.patch
Normal file
70
0021-lvmcache-fix-memleaks-on-list-removal.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From f59ec61fa79001bd440d0bec32a59971efa2d032 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Wed, 3 Apr 2024 17:54:48 -0500
|
||||
Subject: [PATCH] lvmcache: fix memleaks on list removal
|
||||
Reference:https://github.com/lvmteam/lvm2/commit/f59ec61fa79001bd440d0bec32a59971efa2d032
|
||||
|
||||
---
|
||||
lib/cache/lvmcache.c | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
|
||||
index b8a9eac..2315d8e 100644
|
||||
--- a/lib/cache/lvmcache.c
|
||||
+++ b/lib/cache/lvmcache.c
|
||||
@@ -912,8 +912,10 @@ next:
|
||||
}
|
||||
|
||||
/* Remove dev_mpath from altdevs. */
|
||||
- if ((devl = device_list_find_dev(&altdevs, dev_mpath)))
|
||||
+ if ((devl = device_list_find_dev(&altdevs, dev_mpath))) {
|
||||
dm_list_del(&devl->list);
|
||||
+ free(devl);
|
||||
+ }
|
||||
|
||||
/* Remove info from lvmcache that came from the component dev. */
|
||||
log_debug("Ignoring multipath component %s with PVID %s (dropping info)", dev_name(dev_drop), pvid);
|
||||
@@ -950,6 +952,7 @@ next:
|
||||
|
||||
log_debug("Ignoring multipath component %s with PVID %s (dropping duplicate)", dev_name(dev_drop), pvid);
|
||||
dm_list_del(&devl->list);
|
||||
+ free(devl);
|
||||
|
||||
cmd->filter->wipe(cmd, cmd->filter, dev_drop, NULL);
|
||||
dev_drop->flags &= ~DEV_SCAN_FOUND_LABEL;
|
||||
@@ -979,8 +982,10 @@ next:
|
||||
}
|
||||
|
||||
/* Remove dev_md from altdevs. */
|
||||
- if ((devl = device_list_find_dev(&altdevs, dev_md)))
|
||||
+ if ((devl = device_list_find_dev(&altdevs, dev_md))) {
|
||||
dm_list_del(&devl->list);
|
||||
+ free(devl);
|
||||
+ }
|
||||
|
||||
/* Remove info from lvmcache that came from the component dev. */
|
||||
log_debug("Ignoring md component %s with PVID %s (dropping info)", dev_name(dev_drop), pvid);
|
||||
@@ -1007,8 +1012,10 @@ next:
|
||||
}
|
||||
|
||||
/* Remove dev_md from altdevs. */
|
||||
- if ((devl = device_list_find_dev(&altdevs, dev_md)))
|
||||
- dm_list_del(&devl->list);
|
||||
+ if ((devl = device_list_find_dev(&altdevs, dev_md))) {
|
||||
+ dm_list_del(&devl->list);
|
||||
+ free(devl);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (info && !dev_md) {
|
||||
@@ -1036,6 +1043,7 @@ next:
|
||||
|
||||
log_debug("Ignoring md component %s with PVID %s (dropping duplicate)", dev_name(dev_drop), pvid);
|
||||
dm_list_del(&devl->list);
|
||||
+ free(devl);
|
||||
|
||||
cmd->filter->wipe(cmd, cmd->filter, dev_drop, NULL);
|
||||
dev_drop->flags &= ~DEV_SCAN_FOUND_LABEL;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
Name: lvm2
|
||||
Version: 2.03.21
|
||||
Release: 10
|
||||
Release: 11
|
||||
Epoch: 8
|
||||
Summary: Tools for logical volume management
|
||||
License: GPLv2+ and LGPLv2.1 and BSD
|
||||
@ -69,6 +69,7 @@ Patch17: 0017-clean-up-group-struct-in-_stats_create_group-error-path.patch
|
||||
Patch18: 0018-do-not-pass-empty-string-in-callback.patch
|
||||
Patch19: 0019-fix-memleak-in-vgchange.patch
|
||||
Patch20: 0020-udev-create-dev-disk-by-label-symlinks-for-DM-devs-t.patch
|
||||
Patch21: 0021-lvmcache-fix-memleaks-on-list-removal.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
@ -495,6 +496,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Aug 6 2024 kouwenqi <kouwenqi@kylinos.cn> - 8:2.03.21-11
|
||||
- lvmcache: fix memleaks on list removal
|
||||
|
||||
* Mon Jun 24 2024 wangziliang <wangziliang@kylinos.cn> - 8:2.03.21-10
|
||||
- backport upstream patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user