From 10a08e8d4cc37d7e3af4330e53a498b102b70db4 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Fri, 6 Mar 2026 08:38:06 +0100 Subject: [PATCH] RHEL-147205 - endless poll loop in http_write when POLLHUP is returned Resolves: RHEL-147205 --- ...not-check-for-errno-after-I-O-operat.patch | 44 +++++++++++++++++++ cups.spec | 9 +++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 0001-tls-gnutls.c-Do-not-check-for-errno-after-I-O-operat.patch diff --git a/0001-tls-gnutls.c-Do-not-check-for-errno-after-I-O-operat.patch b/0001-tls-gnutls.c-Do-not-check-for-errno-after-I-O-operat.patch new file mode 100644 index 0000000..1ddfebd --- /dev/null +++ b/0001-tls-gnutls.c-Do-not-check-for-errno-after-I-O-operat.patch @@ -0,0 +1,44 @@ +From e2419c698922fb65ef62250a4588104021449b55 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Fri, 6 Mar 2026 08:31:47 +0100 +Subject: [PATCH] tls-gnutls.c: Do not check for errno after I/O operations + +Based on gnutls_record_send/recv man pages, we should use the return +value of the functions as indicator what happened in the function and do +not look into errno at all. + +Checking the errno value caused infinity loop in cupsd on busy servers +if there were enough connection errors when cupsd wrote the response. + +The patch is provided by Paul Zirnik from SUSE - thank you for the +patch! + +Fixes #827 +--- + cups/tls-gnutls.c | 4 ++-- + +diff --git a/cups/tls-gnutls.c b/cups/tls-gnutls.c +index 64f2af372..5769d6313 100644 +--- a/cups/tls-gnutls.c ++++ b/cups/tls-gnutls.c +@@ -1208,7 +1208,7 @@ _httpTLSRead(http_t *http, /* I - Connection to server */ + + result = gnutls_record_recv(http->tls, buf, (size_t)len); + +- if (result < 0 && !errno) ++ if (result < 0) + { + /* + * Convert GNU TLS error to errno value... +@@ -1669,7 +1669,7 @@ _httpTLSWrite(http_t *http, /* I - Connection to server */ + + result = gnutls_record_send(http->tls, buf, (size_t)len); + +- if (result < 0 && !errno) ++ if (result < 0) + { + /* + * Convert GNU TLS error to errno value... +-- +2.53.0 + diff --git a/cups.spec b/cups.spec index 86b4385..e6f35f4 100644 --- a/cups.spec +++ b/cups.spec @@ -22,7 +22,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.2.6 -Release: 66%{?dist} +Release: 67%{?dist} License: GPLv2+ and LGPLv2 with exceptions and AML Url: http://www.cups.org/ Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz @@ -212,6 +212,8 @@ Patch104: 0001-conf.c-Fix-stopping-scheduler-on-unknown-directive.patch # fix use-after-free reported by OSH # https://github.com/OpenPrinting/cups/pull/1454 Patch105: 0001-scheduler-Fix-possible-use_after_free-in-cupsdReadCl.patch +# RHEL-147205 - endless poll loop in http_write when POLLHUP is returned +Patch106: 0001-tls-gnutls.c-Do-not-check-for-errno-after-I-O-operat.patch Patch1000: cups-lspp.patch @@ -554,6 +556,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch104 -p1 -b .ignore-unknown # fix use-after-free reported by OSH %patch105 -p1 -b .osh-use-after-free +# RHEL-147205 - endless poll loop in http_write when POLLHUP is returned +%patch106 -p1 -b .httpwrite-endless-poll sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in @@ -981,6 +985,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Fri Mar 06 2026 Zdenek Dohnal - 1:2.2.6-67 +- RHEL-147205 - endless poll loop in http_write when POLLHUP is returned + * Fri Dec 12 2025 Zdenek Dohnal - 1:2.2.6-66 - fix use-after-free reported by OSH