Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2018 15:01:23 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330843 - head/sys/dev/efidev
Message-ID:  <201803131501.w2DF1NUN064110@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



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