Browse Source

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>
Geliang Tang 9 năm trước cách đây
mục cha
commit
cae7316708
1 tập tin đã thay đổi với 7 bổ sung0 xóa
  1. 7 0
      drivers/firmware/efi/efi-pstore.c

+ 7 - 0
drivers/firmware/efi/efi-pstore.c

@@ -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);