resolv_conf: release lock on allocation failure (#2213909)

Resolves: #2213909
This commit is contained in:
DJ Delorie 2023-07-03 19:07:30 -04:00
parent e29aaea52c
commit a9c42b37f5
2 changed files with 31 additions and 1 deletions

26
glibc-rh2213909.patch Normal file
View File

@ -0,0 +1,26 @@
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: 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 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);
}

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.28
%define glibcversion 2.28
%define glibcrelease 228%{?dist}
%define glibcrelease 229%{?dist}
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -1037,6 +1037,7 @@ Patch844: glibc-rh2172949.patch
Patch845: glibc-rh2180155-1.patch
Patch846: glibc-rh2180155-2.patch
Patch847: glibc-rh2180155-3.patch
Patch848: glibc-rh2213909.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2867,6 +2868,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Mon Jul 3 2023 DJ Delorie <dj@redhat.com> - 2.28-229
- resolv_conf: release lock on allocation failure (#2213909)
* Mon May 22 2023 Florian Weimer <fweimer@redhat.com> - 2.28-228
- gmon: Various bug fixes (#2180155)