svn commit: r348541 - head/sys/dev/efidev

Konstantin Belousov kib at FreeBSD.org
Mon Jun 3 15:41:46 UTC 2019


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 at 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


More information about the svn-src-head mailing list