Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2018 02:59:14 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331114 - stable/11/sys/dev/efidev
Message-ID:  <201803180259.w2I2xEvV049034@repo.freebsd.org>

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



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