Fix crash when reporting CREATE INDEX progress

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: 1cd5bc3ccf92a511b087629b2c914dffa9151fce
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2019-10-16T12:51:23Z
Releases: 12.1
Fix crash when reporting CREATE INDEX progress

A race condition can make us try to dereference a NULL pointer to the
PGPROC struct of a process that's already finished.  That results in
crashes during REINDEX CONCURRENTLY and CREATE INDEX CONCURRENTLY.

This was introduced in ab0dfc961b6a, so backpatch to pg12.

Reported by: Justin Pryzby
Reviewed-by: Michaël Paquier
Discussion: https://postgr.es/m/20191012004446.GT10470@telsasoft.com

Files

PathChange+/−
src/backend/commands/indexcmds.c modified +4 −2
src/backend/storage/lmgr/lmgr.c modified +4 −6

Discussion