Author: kevans
Date: Tue Mar 13 15:01:23 2018
New Revision: 330843
URL: https://svnweb.freebsd.org/changeset/base/330843

Log:
  efirtc: Pass a dummy tmcap pointer to efi_get_time_locked
  
  As noted in the comment, UEFI spec claims the capabilities pointer is
  optional, but some implementations will choke and attempt to dereference it
  without checking. This specific problem was found on a Lenovo Thinkpad X220
  that would panic in efirtc_identify.

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

Modified: head/sys/dev/efidev/efirt.c
==============================================================================
--- head/sys/dev/efidev/efirt.c Tue Mar 13 13:09:10 2018        (r330842)
+++ head/sys/dev/efidev/efirt.c Tue Mar 13 15:01:23 2018        (r330843)
@@ -259,12 +259,19 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca
 int
 efi_get_time(struct efi_tm *tm)
 {
+       struct efi_tmcap dummy;
        int error;
 
        if (efi_runtime == NULL)
                return (ENXIO);
        EFI_TIME_LOCK()
-       error = efi_get_time_locked(tm, NULL);
+       /*
+        * UEFI spec states that the Capabilities argument to GetTime is
+        * optional, but some UEFI implementations choke when passed a NULL
+        * pointer. Pass a dummy efi_dmcap, even though we won't use it,
+        * to workaround such implementations.
+        */
+       error = efi_get_time_locked(tm, &dummy);
        EFI_TIME_UNLOCK()
        return (error);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to