resolv_conf: release lock on allocation failure (bug 30527)

(cherry picked from commit 0652cd2981823513710ff9622318f642dcdd0735)
This commit is contained in:
zhanghao 2023-08-14 21:01:14 +08:00 committed by openeuler-sync-bot
parent 715a4e00df
commit 417d94e473
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From abcf8db7fa46b73fd5b8193ce11f9312301b84c7 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 7 Jun 2023 11:21:48 +0200
Subject: [PATCH] resolv_conf: release lock on allocation failure (bug 30527)
When the initial allocation of global fails, the local lock is left
locked.
Reported by Steffen Lammel of SAP HANA development.
---
resolv/resolv_conf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c
index bd5890773b..8bc9edc634 100644
--- a/resolv/resolv_conf.c
+++ b/resolv/resolv_conf.c
@@ -93,7 +93,10 @@ get_locked_global (void)
{
global_copy = calloc (1, sizeof (*global));
if (global_copy == NULL)
- return NULL;
+ {
+ __libc_lock_unlock (lock);
+ return NULL;
+ }
atomic_store_relaxed (&global, global_copy);
resolv_conf_array_init (&global_copy->array);
}
--
2.23.0

View File

@ -70,7 +70,7 @@
############################################################################## ##############################################################################
Name: glibc Name: glibc
Version: 2.34 Version: 2.34
Release: 130 Release: 131
Summary: The GNU libc libraries Summary: The GNU libc libraries
License: %{all_license} License: %{all_license}
URL: http://www.gnu.org/software/glibc/ URL: http://www.gnu.org/software/glibc/
@ -329,6 +329,8 @@ Patch9046: fix-Segmentation-fault-in-nss-module.patch
Patch9047: fix_nss_database_check_reload_and_get_memleak.patch Patch9047: fix_nss_database_check_reload_and_get_memleak.patch
Patch9048: inet-fix-warn-unused-result.patch Patch9048: inet-fix-warn-unused-result.patch
Patch9049: backport-resolv_conf-release-lock-on-allocation-failure-bug-30527.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext
@ -1493,6 +1495,9 @@ fi
%endif %endif
%changelog %changelog
* Mon Aug 14 2023 zhanghao<zhanghao383@huawei.com> - 2.34-131
- resolv_conf: release lock on allocation failure (bug 30527)
* Wed Aug 9 2023 liubo<liubo335@huawei.com> - 2.34-130 * Wed Aug 9 2023 liubo<liubo335@huawei.com> - 2.34-130
- inet fix warn unused result - inet fix warn unused result