BUG #17186: In connect.c, the lock connections_mutex is not correctly released(Line 463) at the return(Line 522)
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ryancaicse@gmail.com
Date: 2021-09-10T04:29:36Z
Lists: pgsql-bugs
The following bug has been logged on the website: Bug reference: 17186 Logged by: An improper locking bug due to the unreleased lock connections_mutex in /ecpg/ecpglib/connect.c Email address: ryancaicse@gmail.com PostgreSQL version: 14beta3 Operating system: All Description: This is a possible improper locking bug, which can lead to resource leaks and even deadlock. I am not sure whether it can lead to a security problem. The problem is that the lock connections_mutex should be released at the end of the function. But it not released when conn_keywords == NULL || conn_values == NULL (ecpg_alloc got errors and return NULL). Thank you for your checking. Locations: https://github.com/postgres/postgres/blob/c30f54ad732ca5c8762bb68bbe0f51de9137dd72/src/interfaces/ecpg/ecpglib/connect.c#L463 https://github.com/postgres/postgres/blob/c30f54ad732ca5c8762bb68bbe0f51de9137dd72/src/interfaces/ecpg/ecpglib/connect.c#L522
Commits
-
Fix error handling with threads on OOM in ECPG connection logic
- 3768c468df58 9.6.24 landed
- 83a3737a63a5 10.19 landed
- b6a10ff4abe9 11.14 landed
- b34dcf87f685 12.9 landed
- b589d212fdd7 13.5 landed
- cc057fb315e2 14.0 landed
- fa703b317e9d 15.0 landed
-
Detect POLLHUP/POLLRDHUP while running queries.
- c30f54ad732c 14.0 cited