From 79faee6c97e4845f8df304f3599a09eb0ea7e047 Mon Sep 17 00:00:00 2001 From: markeryang Date: Tue, 30 Nov 2021 18:46:33 +0800 Subject: [PATCH] fix nfs-blkmapd service core dump (cherry picked from commit c0494a37be03fd2980aa82ecfd2b1e8528a82023) --- 0002-fix-coredump-in-bl_add_disk.patch | 44 ++++++++++++++++++++++++++ nfs-utils.spec | 6 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0002-fix-coredump-in-bl_add_disk.patch diff --git a/0002-fix-coredump-in-bl_add_disk.patch b/0002-fix-coredump-in-bl_add_disk.patch new file mode 100644 index 0000000..beb2771 --- /dev/null +++ b/0002-fix-coredump-in-bl_add_disk.patch @@ -0,0 +1,44 @@ +From c7e995c8a4a3985d1b315814d29e8d9211d6dc5e Mon Sep 17 00:00:00 2001 +From: lixiaokeng +Date: Tue, 30 Nov 2021 16:38:02 +0800 +Subject: [PATCH 1/2] fix coredump in bl_add_disk + +The serial->data is not malloced separately, so it can't be freed. +Just free(serial). + +Signed-off-by: Lixiaokeng +--- + utils/blkmapd/device-discovery.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c +index f5f9b10..2c50205 100644 +--- a/utils/blkmapd/device-discovery.c ++++ b/utils/blkmapd/device-discovery.c +@@ -188,7 +188,6 @@ static void bl_add_disk(char *filepath) + + if (disk && diskpath) { + if (serial) { +- free(serial->data); + free(serial); + } + return; +@@ -229,7 +228,6 @@ static void bl_add_disk(char *filepath) + disk->valid_path = path; + } + if (serial) { +- free(serial->data); + free(serial); + } + } +@@ -242,7 +240,6 @@ static void bl_add_disk(char *filepath) + free(path); + } + if (serial) { +- free(serial->data); + free(serial); + } + return; +-- +2.26.1.windows.1 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 50947cf..3d5bf7f 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -4,7 +4,7 @@ Name: nfs-utils Version: 2.5.1 -Release: 3 +Release: 4 Epoch: 1 Summary: The Linux NFS userland utility package License: MIT and GPLv2 and GPLv2+ and BSD @@ -14,6 +14,7 @@ Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{v Patch0: 0000-systemd-idmapd-require-rpc-pipefs.patch Patch1: 0001-correct-the-statd-path-in-man.patch +Patch2: 0002-fix-coredump-in-bl_add_disk.patch BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 @@ -222,6 +223,9 @@ fi %{_mandir}/*/* %changelog +* Tue Nov 30 2021 yanglongkang - 2.5.1-4 +- fix nfs-blkmapd service core dump + * Wed Nov 11 2020 lixiaokeng - 2.5.1-3 - add epoch to the version of help package required -- Gitee