Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

efi-pstore: implement efivars_pstore_exit()

The original efivars_pstore_exit() is empty. I
1) add a bufsize check statement.
2) call pstore_unregister as it is defined now.
3) free the memory and set bufsize to 0.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Kees Cook <keescook@chromium.org>

authored by

Geliang Tang and committed by
Kees Cook
cae73167 52d210d9

+7
+7
drivers/firmware/efi/efi-pstore.c
··· 399 399 400 400 static __exit void efivars_pstore_exit(void) 401 401 { 402 + if (!efi_pstore_info.bufsize) 403 + return; 404 + 405 + pstore_unregister(&efi_pstore_info); 406 + kfree(efi_pstore_info.buf); 407 + efi_pstore_info.buf = NULL; 408 + efi_pstore_info.bufsize = 0; 402 409 } 403 410 404 411 module_init(efivars_pstore_init);