From: Matt Fleming Date: Mon, 29 Apr 2013 19:06:37 +0000 (+0100) Subject: efi, pstore: Remove entry from list when erasing X-Git-Tag: v5.15~20230^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12abcfde1ad3ee9bed726d25fdd4eeb31026b187;p=platform%2Fkernel%2Flinux-starfive.git efi, pstore: Remove entry from list when erasing We need to remove the entry from the EFI variable list before we erase it from the variable store and free the associated state, otherwise it's possible to hit the following crash, BUG: unable to handle kernel NULL pointer dereference at (null) IP: [] __efivar_entry_iter+0xcf/0x120 PGD 19483f067 PUD 195426067 PMD 0 Oops: 0000 [#1] SMP [...] Call Trace: [] efi_pstore_erase+0xef/0x140 [] ? math_error+0x288/0x2d0 [] pstore_unlink+0x41/0x60 [] vfs_unlink+0x9f/0x110 [] do_unlinkat+0x18b/0x280 [] ? sys_newfstatat+0x36/0x50 [] sys_unlinkat+0x22/0x40 [] system_call_fastpath+0x16/0x1b Reported-by: Seiji Aguchi Tested-by: Seiji Aguchi Cc: Tony Luck Cc: Matthew Garrett Signed-off-by: Matt Fleming --- diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 583ee80..af45c42 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -167,6 +167,8 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data) /* found */ __efivar_entry_delete(entry); + list_del(&entry->list); + return 1; }