From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752682AbbJWPFS (ORCPT ); Fri, 23 Oct 2015 11:05:18 -0400 Received: from m50-138.163.com ([123.125.50.138]:33541 "EHLO m50-138.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598AbbJWPFQ (ORCPT ); Fri, 23 Oct 2015 11:05:16 -0400 From: Geliang Tang To: Matt Fleming , Anton Vorontsov , Colin Cross , Kees Cook , Tony Luck Cc: Geliang Tang , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] efi-pstore: implement efivars_pstore_exit() Date: Fri, 23 Oct 2015 22:56:23 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: X-CM-TRANSID: C9GowABHp1+hSipWmVozAA--.1495S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF1fJrWUXr48Gr17GFW3ZFb_yoWfWFXEk3 yUJry8Wr1UC3yxuw4Yyr13Z34UWw4kWan5uasFyanIkryxAa1DJw1DZa4xZanrGFW2yFZ8 A39FqF48Zw4UGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjU73PUUUUU== X-Originating-IP: [116.77.138.30] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiNQKcmVSIJp1KyQAAsW Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/firmware/efi/efi-pstore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index c8d794c..453ac19 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -393,6 +393,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); -- 2.5.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geliang Tang Subject: [PATCH 2/2] efi-pstore: implement efivars_pstore_exit() Date: Fri, 23 Oct 2015 22:56:23 +0800 Message-ID: References: Return-path: In-Reply-To: In-Reply-To: References: Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Matt Fleming , Anton Vorontsov , Colin Cross , Kees Cook , Tony Luck Cc: Geliang Tang , linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-efi@vger.kernel.org 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 --- drivers/firmware/efi/efi-pstore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index c8d794c..453ac19 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -393,6 +393,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); -- 2.5.0