Skip to content

Commit

Permalink
efi_loader: check CreateEvent() parameters
Browse files Browse the repository at this point in the history
Add some of the invalid parameter checks described in the UEFI
specification for CreateEvent().  This does not include checking
the validity of the type and tpl parameters.

Signed-off-by: Jonathan Gray <[email protected]>
Acked-By: Heinrich Schuchardt <[email protected]>
[agraf: fix checkpatch.pl indent warning]
Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
jonathangray authored and agraf committed Jul 3, 2017
1 parent 37a980b commit a95343b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/efi_loader/efi_boottime.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ static efi_status_t EFIAPI efi_create_event(
return EFI_EXIT(EFI_OUT_OF_RESOURCES);
}

if (event == NULL)
return EFI_EXIT(EFI_INVALID_PARAMETER);

if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT))
return EFI_EXIT(EFI_INVALID_PARAMETER);

if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) &&
notify_function == NULL)
return EFI_EXIT(EFI_INVALID_PARAMETER);

efi_event.type = type;
efi_event.notify_tpl = notify_tpl;
efi_event.notify_function = notify_function;
Expand Down

0 comments on commit a95343b

Please sign in to comment.