Author: kib
Date: Mon Jun 10 17:44:50 2019
New Revision: 348872
URL: https://svnweb.freebsd.org/changeset/base/348872

Log:
  MFC r348541:
  efirt efi_enter(): Release acquired locks and restore FPU ownership if
  efi_arch_enter() returned an error.

Modified:
  stable/12/sys/dev/efidev/efirt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/efidev/efirt.c
==============================================================================
--- stable/12/sys/dev/efidev/efirt.c    Mon Jun 10 17:43:33 2019        
(r348871)
+++ stable/12/sys/dev/efidev/efirt.c    Mon Jun 10 17:44:50 2019        
(r348872)
@@ -247,6 +247,7 @@ efi_enter(void)
 {
        struct thread *td;
        pmap_t curpmap;
+       int error;
 
        if (efi_runtime == NULL)
                return (ENXIO);
@@ -255,7 +256,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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to