HomeFreeBSD

Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).

Description

Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).

Leave robust-protected region before checking for cancellation by
calling _thr_testcancel(). Otherwise, if cancelling request was
pending, the cancel handler is called with the dandling inact_mtx,
which triggers an assert if any mutex operation is performed by the
handler.

Reported and tested by: Dimitri Staessens <dimitri.staessens@intec.ugent.be>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Details

Provenance
kibAuthored on
Parents
rS309629: MFC r309282: Explicitly initialize cdai.flags.
Branches
Unknown
Tags
Unknown