mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-15 09:27:35 +00:00
efi_loader: check parameters of CreateEvent
Rigorously check the TPL level and the event type. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
42a3d42688
commit
21b3edfc96
1 changed files with 32 additions and 3 deletions
|
@ -190,6 +190,25 @@ static void efi_queue_event(struct efi_event *event, bool check_tpl)
|
||||||
event->is_queued = false;
|
event->is_queued = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is_valid_tpl() - check if the task priority level is valid
|
||||||
|
*
|
||||||
|
* @tpl: TPL level to check
|
||||||
|
* ReturnValue: status code
|
||||||
|
*/
|
||||||
|
efi_status_t is_valid_tpl(efi_uintn_t tpl)
|
||||||
|
{
|
||||||
|
switch (tpl) {
|
||||||
|
case TPL_APPLICATION:
|
||||||
|
case TPL_CALLBACK:
|
||||||
|
case TPL_NOTIFY:
|
||||||
|
case TPL_HIGH_LEVEL:
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
default:
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* efi_signal_event() - signal an EFI event
|
* efi_signal_event() - signal an EFI event
|
||||||
* @event: event to signal
|
* @event: event to signal
|
||||||
|
@ -592,11 +611,21 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
|
||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT))
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
case EVT_TIMER:
|
||||||
|
case EVT_NOTIFY_SIGNAL:
|
||||||
|
case EVT_TIMER | EVT_NOTIFY_SIGNAL:
|
||||||
|
case EVT_NOTIFY_WAIT:
|
||||||
|
case EVT_TIMER | EVT_NOTIFY_WAIT:
|
||||||
|
case EVT_SIGNAL_EXIT_BOOT_SERVICES:
|
||||||
|
case EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
if ((type & (EVT_NOTIFY_SIGNAL | EVT_NOTIFY_WAIT)) &&
|
if (is_valid_tpl(notify_tpl) != EFI_SUCCESS)
|
||||||
notify_function == NULL)
|
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
evt = calloc(1, sizeof(struct efi_event));
|
evt = calloc(1, sizeof(struct efi_event));
|
||||||
|
|
Loading…
Reference in a new issue