svn commit: r331114 - stable/11/sys/dev/efidev

Eitan Adler eadler at FreeBSD.org
Sun Mar 18 02:59:15 UTC 2018


Author: eadler
Date: Sun Mar 18 02:59:14 2018
New Revision: 331114
URL: https://svnweb.freebsd.org/changeset/base/331114

Log:
  MFC r330843:
  
  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.
  
  Requested by:	kevans

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

Modified: stable/11/sys/dev/efidev/efirt.c
==============================================================================
--- stable/11/sys/dev/efidev/efirt.c	Sat Mar 17 21:58:41 2018	(r331113)
+++ stable/11/sys/dev/efidev/efirt.c	Sun Mar 18 02:59:14 2018	(r331114)
@@ -260,12 +260,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);
 }


More information about the svn-src-all mailing list