Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2019 15:41:45 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348541 - head/sys/dev/efidev
Message-ID:  <201906031541.x53Ffjl9081530@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jun  3 15:41:45 2019
New Revision: 348541
URL: https://svnweb.freebsd.org/changeset/base/348541

Log:
  efirt efi_enter(): Release acquired locks and restore FPU ownership if
  efi_arch_enter() returned an error.
  
  Submitted:	Jan Martin Mikkelsen <janm@transactionware.com>
  MFC after:	1 week

Modified:
  head/sys/dev/efidev/efirt.c

Modified: head/sys/dev/efidev/efirt.c
==============================================================================
--- head/sys/dev/efidev/efirt.c	Mon Jun  3 15:34:00 2019	(r348540)
+++ head/sys/dev/efidev/efirt.c	Mon Jun  3 15:41:45 2019	(r348541)
@@ -275,6 +275,7 @@ efi_enter(void)
 {
 	struct thread *td;
 	pmap_t curpmap;
+	int error;
 
 	if (efi_runtime == NULL)
 		return (ENXIO);
@@ -283,7 +284,13 @@ efi_enter(void)
 	PMAP_LOCK(curpmap);
 	mtx_lock(&efi_lock);
 	fpu_kern_enter(td, NULL, FPU_KERN_NOCTX);
-	return (efi_arch_enter());
+	error = efi_arch_enter();
+	if (error != 0) {
+		fpu_kern_leave(td, NULL);
+		mtx_unlock(&efi_lock);
+		PMAP_UNLOCK(curpmap);
+	}
+	return (error);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906031541.x53Ffjl9081530>