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.
This commit is contained in:
parent
b7feabf906
commit
8521b4a9df
@ -259,12 +259,19 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap)
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user