diff --git a/0024-config-check-for-0-from-read.patch b/0024-config-check-for-0-from-read.patch new file mode 100644 index 0000000000000000000000000000000000000000..ad708c19270754ce4ff0b5e830edb95af4fffbf3 --- /dev/null +++ b/0024-config-check-for-0-from-read.patch @@ -0,0 +1,31 @@ +From 713310b93d85ffd01aae26f3d878a8b0453fa506 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Wed, 29 Jan 2025 00:00:23 +0100 +Subject: [PATCH] config: check for 0 from read + +When the read returns 0, it could mean the file +was trimmed or some other type of problem. +In this case abort the potentially endless loop. + +Reference: https://github.com/lvmteam/lvm2/commit/e907c3cf9a1c294b6551d525d58f2bd7dbbb1cc5 +Conflict: NA +--- + lib/config/config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/config/config.c b/lib/config/config.c +index 5986e64..02c757e 100644 +--- a/lib/config/config.c ++++ b/lib/config/config.c +@@ -536,7 +536,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, dev_io_r + sz = read(dev_fd(dev), buf + rsize, size - rsize); + } while ((sz < 0) && ((errno == EINTR) || (errno == EAGAIN))); + +- if (sz < 0) { ++ if (sz <= 0) { + log_sys_error("read", dev_name(dev)); + goto out; + } +-- +2.33.0 + diff --git a/lvm2.spec b/lvm2.spec index 24e641aada2d390b1efb50cbeefe028d6120c666..54937c2dc66ca1393a961e8c73e421015ba6765a 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.21 -Release: 14 +Release: 15 Epoch: 8 Summary: Tools for logical volume management License: GPLv2+ and LGPLv2.1 and BSD @@ -72,6 +72,7 @@ Patch20: 0020-udev-create-dev-disk-by-label-symlinks-for-DM-devs-t.patch Patch21: 0021-lvmcache-fix-memleaks-on-list-removal.patch Patch22: 0022-dmstats-Fix-memory-leak-on-error-path.patch Patch23: 0023-fix-function-undeclared-in-libdm-common.c-and-dev-cache.c.patch +Patch24: 0024-config-check-for-0-from-read.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -498,6 +499,12 @@ fi %changelog +* Thu Apr 03 2025 chenrenhui - 8:2.03.21-15 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:check for 0 from read + * Tue Nov 05 2024 shenzhongwei - 8:2.03.21-14 - Type:bugfix - ID:NA