config: check for 0 from read
(cherry picked from commit 232d376cffe309432cacb31ea72f6785ee3ba512)
This commit is contained in:
parent
7ea54be544
commit
b8f9a15d84
31
0024-config-check-for-0-from-read.patch
Normal file
31
0024-config-check-for-0-from-read.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 713310b93d85ffd01aae26f3d878a8b0453fa506 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||||
|
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
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
Name: lvm2
|
Name: lvm2
|
||||||
Version: 2.03.21
|
Version: 2.03.21
|
||||||
Release: 14
|
Release: 15
|
||||||
Epoch: 8
|
Epoch: 8
|
||||||
Summary: Tools for logical volume management
|
Summary: Tools for logical volume management
|
||||||
License: GPLv2+ and LGPLv2.1 and BSD
|
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
|
Patch21: 0021-lvmcache-fix-memleaks-on-list-removal.patch
|
||||||
Patch22: 0022-dmstats-Fix-memory-leak-on-error-path.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
|
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
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@ -498,6 +499,12 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Apr 03 2025 chenrenhui <chenrenhui1@huawei.com> - 8:2.03.21-15
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:check for 0 from read
|
||||||
|
|
||||||
* Tue Nov 05 2024 shenzhongwei <shenzhongwei@kylinos.cn> - 8:2.03.21-14
|
* Tue Nov 05 2024 shenzhongwei <shenzhongwei@kylinos.cn> - 8:2.03.21-14
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user