resolv_conf: release lock on allocation failure (#2213908)

Resolves: #2213908
This commit is contained in:
Arjun Shankar 2023-06-26 16:53:50 +02:00
parent b5345eb1b6
commit f9ff3ef63b
2 changed files with 32 additions and 1 deletions

27
glibc-rh2213908.patch Normal file
View File

@ -0,0 +1,27 @@
commit abcf8db7fa46b73fd5b8193ce11f9312301b84c7
Author: Andreas Schwab <schwab@suse.de>
Date: Wed Jun 7 11:21:48 2023 +0200
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.
diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c
index 9010bf0ea4d84557..aab79e9f4e323df9 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);
}

View File

@ -155,7 +155,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 69%{?dist}
Release: 70%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -723,6 +723,7 @@ Patch484: glibc-upstream-2.34-397.patch
# All future backports need maintain CentOS 9 Stream and RHEL 9 only.
Patch485: glibc-rh2215368.patch
Patch486: glibc-rh2213908.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2880,6 +2881,9 @@ update_gconv_modules_cache ()
%endif
%changelog
* Mon Jun 26 2023 Arjun Shankar <arjun@redhat.com> - 2.34-70
- resolv_conf: release lock on allocation failure (#2213908)
* Mon Jun 26 2023 Arjun Shankar <arjun@redhat.com> - 2.34-69
- strerror must not return NULL (#2215368)