提交 71275a3e 编写于 作者: X xypron.glpk@gmx.de 提交者: Alexander Graf

efi_memory: avoid NULL dereference in efi_free_pool

If efi_free_pool is called with argument NULL an illegal memory
access occurs.

So let's check the parameter on entry.
Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: NAlexander Graf <agraf@suse.de>
上级 70bfcdc6
...@@ -379,6 +379,9 @@ efi_status_t efi_free_pool(void *buffer) ...@@ -379,6 +379,9 @@ efi_status_t efi_free_pool(void *buffer)
efi_status_t r; efi_status_t r;
struct efi_pool_allocation *alloc; struct efi_pool_allocation *alloc;
if (buffer == NULL)
return EFI_INVALID_PARAMETER;
alloc = container_of(buffer, struct efi_pool_allocation, data); alloc = container_of(buffer, struct efi_pool_allocation, data);
/* Sanity check, was the supplied address returned by allocate_pool */ /* Sanity check, was the supplied address returned by allocate_pool */
assert(((uintptr_t)alloc & EFI_PAGE_MASK) == 0); assert(((uintptr_t)alloc & EFI_PAGE_MASK) == 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册