efi-pstore: implement efivars_pstore_exit()
authorGeliang Tang <geliangtang@163.com>
Sat, 7 Nov 2015 04:43:48 +0000 (12:43 +0800)
committerKees Cook <keescook@chromium.org>
Thu, 2 Jun 2016 18:25:31 +0000 (11:25 -0700)
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>
drivers/firmware/efi/efi-pstore.c

index d5903ea..30a24d0 100644 (file)
@@ -399,6 +399,13 @@ static __init int efivars_pstore_init(void)
 
 static __exit void efivars_pstore_exit(void)
 {
+       if (!efi_pstore_info.bufsize)
+               return;
+
+       pstore_unregister(&efi_pstore_info);
+       kfree(efi_pstore_info.buf);
+       efi_pstore_info.buf = NULL;
+       efi_pstore_info.bufsize = 0;
 }
 
 module_init(efivars_pstore_init);