1 commit 59b7c104ce06c90be20ff50435d912a444341245
2 Author: Yann Ylavic <ylavic@apache.org>
3 Date: Tue Oct 12 16:48:18 2021 +0000
5 *) core: Be safe with ap_lingering_close() called with a socket NULL-ed.
10 ap_set_core_module_config(c->conn_config, NULL)
11 before calling ap_lingering_close(), causing a crash after r1891721.
12 Until we have an API to no-op ap_lingering_close(), let's be safe.
14 * server/connection.c(ap_start_lingering_close):
15 The socket should not be NULL here, add an assertion.
17 * server/connection.c(ap_lingering_close):
18 Set c->aborted if the socket is NULL, and give up.
20 Submitted by: acmondor <bz.apache.org acmondor.ca>, ylavic
24 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894171 13f79535-47bb-0310-9956-ffa450edef68
26 diff --git a/changes-entries/ap_lingering_close-NULL.txt b/changes-entries/ap_lingering_close-NULL.txt
28 index 0000000000..43cc6930b5
30 +++ b/changes-entries/ap_lingering_close-NULL.txt
32 + *) core: Be safe with ap_lingering_close() called with a socket NULL-ed by
33 + a third-party module. PR 65627.
34 + [acmondor <bz.apache.org acmondor.ca>, Yann Ylavic]
35 diff --git a/server/connection.c b/server/connection.c
36 index f89ac553c6..a7a51cf741 100644
37 --- a/server/connection.c
38 +++ b/server/connection.c
39 @@ -145,9 +145,7 @@ AP_DECLARE(int) ap_start_lingering_close(conn_rec *c)
41 apr_socket_t *csd = ap_get_conn_socket(c);
46 + ap_assert(csd != NULL);
48 if (ap_prep_lingering_close(c)) {
50 @@ -178,6 +176,15 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
51 apr_time_t now, timeup = 0;
52 apr_socket_t *csd = ap_get_conn_socket(c);
55 + /* Be safe with third-party modules that:
56 + * ap_set_core_module_config(c->conn_config, NULL)
57 + * to no-op ap_lingering_close().
63 if (ap_start_lingering_close(c)) {
64 apr_socket_close(csd);