!666 [sync] PR-665: resolv_conf: release lock on allocation failure (bug 30527)

From: @openeuler-sync-bot 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2023-08-15 09:23:20 +00:00 committed by Gitee
commit 496a6a31fe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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
Version: 2.34
Release: 130
Release: 131
Summary: The GNU libc libraries
License: %{all_license}
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
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)
BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext
@ -1493,6 +1495,9 @@ fi
%endif
%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
- inet fix warn unused result