public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4352] libgomp: Release device lock on cbuf error path
@ 2021-10-12 13:51 Julian Brown
  0 siblings, 0 replies; only message in thread
From: Julian Brown @ 2021-10-12 13:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ccfcf08e66c741a1b24a7851a530cf47aa5e704f

commit r12-4352-gccfcf08e66c741a1b24a7851a530cf47aa5e704f
Author: Julian Brown <julian@codesourcery.com>
Date:   Fri Sep 24 04:18:40 2021 -0700

    libgomp: Release device lock on cbuf error path
    
    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.
    
    2021-12-10  Julian Brown  <julian@codesourcery.com>
    
    libgomp/
            * target.c (gomp_copy_host2dev): Release device lock on cbuf
            error path.

Diff:
---
 libgomp/target.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libgomp/target.c b/libgomp/target.c
index 67fcf41cc2e..196dba4f08c 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-12 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 13:51 [gcc r12-4352] libgomp: Release device lock on cbuf error path Julian Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).