]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142438: Added missing GIL release in _PySSL_keylog_callback when keylog_bio is...
authorAZero13 <gfunni234@gmail.com>
Thu, 11 Dec 2025 14:30:39 +0000 (09:30 -0500)
committerGitHub <noreply@github.com>
Thu, 11 Dec 2025 14:30:39 +0000 (23:30 +0900)
Misc/NEWS.d/next/Library/2025-12-08-18-12-44.gh-issue-142438.UF_0nd.rst [new file with mode: 0644]
Modules/_ssl/debughelpers.c

diff --git a/Misc/NEWS.d/next/Library/2025-12-08-18-12-44.gh-issue-142438.UF_0nd.rst b/Misc/NEWS.d/next/Library/2025-12-08-18-12-44.gh-issue-142438.UF_0nd.rst
new file mode 100644 (file)
index 0000000..ec6b3ff
--- /dev/null
@@ -0,0 +1 @@
+Fixed a possible leaked GIL in _PySSL_keylog_callback.
index aee446d0ccb1b816fad559699d97d2cd03402cc8..866c172e4996f7f6218237fbaba8ed9503793b82 100644 (file)
@@ -131,7 +131,7 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
     PyThread_type_lock lock = get_state_sock(ssl_obj)->keylog_lock;
     assert(lock != NULL);
     if (ssl_obj->ctx->keylog_bio == NULL) {
-        return;
+        goto done;
     }
     /*
      * The lock is neither released on exit nor on fork(). The lock is
@@ -155,6 +155,8 @@ _PySSL_keylog_callback(const SSL *ssl, const char *line)
                                              ssl_obj->ctx->keylog_filename);
         ssl_obj->exc = PyErr_GetRaisedException();
     }
+
+done:
     PyGILState_Release(threadstate);
 }