diff --git a/backport-lsblk-fix-memory-leak.patch b/backport-lsblk-fix-memory-leak.patch new file mode 100644 index 0000000000000000000000000000000000000000..53d914198cae2458423478b0a44049e8e1a8ee14 --- /dev/null +++ b/backport-lsblk-fix-memory-leak.patch @@ -0,0 +1,25 @@ +From b13f60104b646b45dc9bf43408e6fdec03382ad9 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 19 Sep 2025 11:37:01 +0800 +Subject: [PATCH] lsblk: fix memory leak [coverity scan] + +Signed-off-by: Karel Zak +--- + misc-utils/lsblk.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index 80941e0..eac581c 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -434,6 +434,7 @@ static char *get_type(struct lsblk_device *dev) + + ul_path_read_string(dev->sysfs, &md_level, "md/level"); + res = (md_level && *md_level) ? md_level : xstrdup("md"); ++ free(md_level); + + } else { + const char *type = NULL; +-- +2.43.0 + diff --git a/backport-lsblk-fix-possible-use-after-free.patch b/backport-lsblk-fix-possible-use-after-free.patch new file mode 100644 index 0000000000000000000000000000000000000000..000e30897aea6b64c2ecca1c3a99bb9308c42ef3 --- /dev/null +++ b/backport-lsblk-fix-possible-use-after-free.patch @@ -0,0 +1,33 @@ +From 02955d9434396df4019132351d8264b74811dc3f Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 19 Sep 2025 11:38:57 +0800 +Subject: [PATCH] lsblk: fix possible use-after-free + +Signed-off-by: Karel Zak +--- + misc-utils/lsblk.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index eac581c..ae8fc6d 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -433,9 +433,12 @@ static char *get_type(struct lsblk_device *dev) + char *md_level = NULL; + + ul_path_read_string(dev->sysfs, &md_level, "md/level"); +- res = (md_level && *md_level) ? md_level : xstrdup("md"); +- free(md_level); +- ++ if (md_level && *md_level) ++ res = md_level; ++ else { ++ free(md_level); /* may be unused empty string */ ++ res = xstrdup("md"); ++ } + } else { + const char *type = NULL; + int x = 0; +-- +2.43.0 + diff --git a/backport-lsblk-use-md-as-fallback-TYPE-when-md-level-empty.patch b/backport-lsblk-use-md-as-fallback-TYPE-when-md-level-empty.patch new file mode 100644 index 0000000000000000000000000000000000000000..2bc8625e1a96d1ae31d35a36ef3e823375f180a5 --- /dev/null +++ b/backport-lsblk-use-md-as-fallback-TYPE-when-md-level-empty.patch @@ -0,0 +1,25 @@ +From 6bed45b965b22c8ea5c10c43320c19cf84fd8cfa Mon Sep 17 00:00:00 2001 +From: codefiles <11915375+codefiles@users.noreply.github.com> +Date: Fri, 19 Sep 2025 11:35:11 +0800 +Subject: [PATCH] lsblk: use md as fallback TYPE when md/level empty + +--- + misc-utils/lsblk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index d3b5a54..80941e0 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -433,7 +433,7 @@ static char *get_type(struct lsblk_device *dev) + char *md_level = NULL; + + ul_path_read_string(dev->sysfs, &md_level, "md/level"); +- res = md_level ? md_level : xstrdup("md"); ++ res = (md_level && *md_level) ? md_level : xstrdup("md"); + + } else { + const char *type = NULL; +-- +2.43.0 + diff --git a/util-linux.spec b/util-linux.spec index aa13f992d6a0eaa38f1de12f1331392c30e447f2..2766eff599bfd0dec7f665ebe3a3356e7e022c23 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -3,7 +3,7 @@ Name: util-linux Version: 2.37.2 -Release: 44 +Release: 45 Summary: A random collection of Linux utilities License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git @@ -172,6 +172,9 @@ Patch6150: backport-mkfs.bfs-fix-memory-leaks-and-weak-code.patch Patch6151: backport-cfdisk-fix-memory-leak-and-possible-NULL-dereference.patch Patch6152: backport-swapoff-clean-up-tag-resolution.patch Patch6153: backport-libblkid-befs-fix-underflow.patch +Patch6154: backport-lsblk-use-md-as-fallback-TYPE-when-md-level-empty.patch +Patch6155: backport-lsblk-fix-memory-leak.patch +Patch6156: backport-lsblk-fix-possible-use-after-free.patch Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch Patch9001: SKIPPED-no-root-permissions-test.patch @@ -551,6 +554,14 @@ fi %{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} %changelog +* Fri Sep 19 2025 cenhuilin - 2.37.2-45 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:lsblk: use md as fallback TYPE when md/level empty + lsblk: fix memory leak [coverity scan] + lsblk: fix possible use-after-free + * Mon Jul 7 2025 YunYi Yang - 2.37.2-44 - Type:bugfix - ID:NA