This patch releases the device lock on a sanity-checking error path in transfer combining (cbuf) handling in libgomp:target.c. This shouldn't happen when handling well-formed mapping clauses, but erroneous clauses can currently cause a hang if the condition triggers.
Tested with offloading to NVPTX. OK? 2021-09-29 Julian Brown <jul...@codesourcery.com> libgomp/ * target.c (gomp_copy_host2dev): Release device lock on cbuf error path. --- libgomp/target.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libgomp/target.c b/libgomp/target.c index 65bb40100e5..84c6fdf2c47 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -385,7 +385,10 @@ gomp_copy_host2dev (struct gomp_device_descr *devicep, else if (cbuf->chunks[middle].start <= doff) { if (doff + sz > cbuf->chunks[middle].end) - gomp_fatal ("internal libgomp cbuf error"); + { + gomp_mutex_unlock (&devicep->lock); + gomp_fatal ("internal libgomp cbuf error"); + } memcpy ((char *) cbuf->buf + (doff - cbuf->chunks[0].start), h, sz); return; -- 2.29.2