From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1410) id 1D185385740C; Tue, 12 Oct 2021 13:51:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D185385740C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Julian Brown To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4352] libgomp: Release device lock on cbuf error path X-Act-Checkin: gcc X-Git-Author: Julian Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: d1dcaa31453fa080a27938b064e53f02272d4aa1 X-Git-Newrev: ccfcf08e66c741a1b24a7851a530cf47aa5e704f Message-Id: <20211012135134.1D185385740C@sourceware.org> Date: Tue, 12 Oct 2021 13:51:34 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2021 13:51:34 -0000 https://gcc.gnu.org/g:ccfcf08e66c741a1b24a7851a530cf47aa5e704f commit r12-4352-gccfcf08e66c741a1b24a7851a530cf47aa5e704f Author: Julian Brown 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 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;