From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175AbbKKXIh (ORCPT ); Wed, 11 Nov 2015 18:08:37 -0500 Received: from mail-io0-f181.google.com ([209.85.223.181]:34266 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752961AbbKKXIf (ORCPT ); Wed, 11 Nov 2015 18:08:35 -0500 MIME-Version: 1.0 In-Reply-To: <20151111165947.GD4889@codeblueprint.co.uk> References: <337377a3fbcf855d6a5217e06fcd8c8a979f2853.1446869434.git.geliangtang@163.com> <20151111165947.GD4889@codeblueprint.co.uk> Date: Wed, 11 Nov 2015 15:08:34 -0800 X-Google-Sender-Auth: nrCg4rMshlcS8bfuF0GGeIOLIjI Message-ID: Subject: Re: [PATCH v2 2/3] efi-pstore: implement efivars_pstore_exit() From: Kees Cook To: Matt Fleming Cc: Geliang Tang , Anton Vorontsov , Colin Cross , Tony Luck , "linux-efi@vger.kernel.org" , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2015 at 8:59 AM, Matt Fleming wrote: > On Sat, 07 Nov, at 12:43:48PM, Geliang Tang wrote: >> 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 eac76a7..62d57d8 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); > > Looks OK to me. Kees, are you picking this up? I can, though usually it goes through Tony. -Kees -- Kees Cook Chrome OS Security