Additional patch for 9.2.0 lvm2

Resolves: #2164226
This commit is contained in:
Marian Csontos 2023-02-15 18:59:56 +01:00
parent 5e0fa0f972
commit f8872c90cd
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From cbcf65c6518652242aab6960eeb983c6bc771bd3 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Sun, 12 Feb 2023 19:23:12 +0100
Subject: [PATCH] filesystem: use PATH_MAX for linux paths
(cherry picked from commit cf0dc9a13cf365859e7dad3bb1ad02040925ae11)
---
lib/device/filesystem.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c
index db507bdda..0c902ec14 100644
--- a/lib/device/filesystem.c
+++ b/lib/device/filesystem.c
@@ -219,10 +219,10 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
FILE *fp;
char proc_line[PATH_MAX];
char proc_fstype[FSTYPE_MAX];
- char proc_devpath[1024];
- char proc_mntpath[1024];
- char lv_mapper_path[1024];
- char mntent_mount_dir[1024];
+ char proc_devpath[PATH_MAX];
+ char proc_mntpath[PATH_MAX];
+ char lv_mapper_path[PATH_MAX];
+ char mntent_mount_dir[PATH_MAX];
char *dm_name;
struct stat st_lv;
struct stat stme;
@@ -262,14 +262,14 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
continue;
if (stme.st_dev != st_lv.st_rdev)
continue;
- strncpy(mntent_mount_dir, me->mnt_dir, PATH_MAX-1);
+ dm_strncpy(mntent_mount_dir, me->mnt_dir, sizeof(mntent_mount_dir));
}
endmntent(fme);
if (!(dm_name = dm_build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL)))
return_0;
- if ((dm_snprintf(lv_mapper_path, 1024, "%s/%s", dm_dir(), dm_name) < 0))
+ if ((dm_snprintf(lv_mapper_path, sizeof(lv_mapper_path), "%s/%s", dm_dir(), dm_name) < 0))
return_0;
if (!(fp = fopen("/proc/mounts", "r")))
--
2.39.1

View File

@ -63,7 +63,7 @@ Version: 2.03.17
#Release: 0.1.20211115git%{shortcommit}%{?dist}%{?rel_suffix}
Release: 4%{?dist}%{?rel_suffix}
%else
Release: 6%{?dist}%{?rel_suffix}
Release: 7%{?dist}%{?rel_suffix}
%endif
License: GPLv2
URL: http://sourceware.org/lvm2
@ -90,6 +90,8 @@ Patch8: 0008-lvresize-only-resize-crypt-when-fs-resize-is-enabled.patch
Patch9: 0009-lvresize-fail-early-if-mounted-LV-was-renamed.patch
# BZ 2158628:
Patch10: 0010-udev-import-previous-results-of-blkid-when-in-suspen.patch
# BZ 2164226:
Patch11: 0011-filesystem-use-PATH_MAX-for-linux-paths.patch
BuildRequires: make
BuildRequires: gcc
@ -160,6 +162,7 @@ or more physical volumes and creating one or more logical volumes
%patch8 -p1 -b .backup8
%patch9 -p1 -b .backup9
%patch10 -p1 -b .backup10
%patch11 -p1 -b .backup11
%build
%global _default_pid_dir /run
@ -731,6 +734,9 @@ An extensive functional testsuite for LVM2.
%endif
%changelog
* Thu Feb 16 2023 Marian Csontos <mcsontos@redhat.com> - 2.03.17-7
- Fix segfault in previous build.
* Thu Feb 09 2023 Marian Csontos <mcsontos@redhat.com> - 2.03.17-6
- Fix lvresize resizing LUKS device only when resizing FS is enabled.
- Improve lvresize handling of renamed volumes.