pgsql: Be more wary about partially-valid LOCALLOCK data in RemoveLocal

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Be more wary about partially-valid LOCALLOCK data in RemoveLocal
Date: 2015-09-20 20:49:14
Message-ID: E1ZdlXu-0003xs-Ep@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Be more wary about partially-valid LOCALLOCK data in RemoveLocalLock().

RemoveLocalLock() must consider the possibility that LockAcquireExtended()
failed to palloc the initial space for a locallock's lockOwners array.
I had evidently meant to cope with this hazard when the code was originally
written (commit 1785acebf2ed14fd66955e2d9a55d77a025f418d), but missed that
the pfree needed to be protected with an if-test. Just to make sure things
are left in a clean state, reset numLockOwners as well.

Per low-memory testing by Andreas Seltenreich. Back-patch to all supported
branches.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7e6e3bdd3c36d77b8a611dbf5e8c72164bc6108b

Modified Files
--------------
src/backend/storage/lmgr/lock.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2015-09-21 01:00:46 pgsql: Restrict file mode creation mask during tmpfile().
Previous Message Michael Meskes 2015-09-19 09:17:14 pgsql: Let compiler handle size calculation of bool types.