Re: [REGRESSION] brcmfmac: NULL pointer deference starting next-20181107

From: Jon Hunter
Date: Tue Nov 13 2018 - 08:32:24 EST



On 13/11/2018 13:21, Jon Hunter wrote:

...

>> IMHO the best fix here would be to modify efivar_entry_size(),
>> adding:
>>
>> ÂÂÂÂif (!ops)
>> ÂÂÂÂÂÂÂ return -ENOENT;
>>
>> Which makes it return the same error as when we do have efivar
>> support but the requested variable is not found.
>
> So the above did not work. I see a patch from Arend and I will give this
> a try.

FWIW, this did work ...

diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 9336ffdf6e2c..8181e548f32b 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -829,9 +829,14 @@ struct efivar_entry *efivar_entry_find(efi_char16_t
*name, efi_guid_t guid,
*/
int efivar_entry_size(struct efivar_entry *entry, unsigned long *size)
{
- const struct efivar_operations *ops = __efivars->ops;
+ const struct efivar_operations *ops;
efi_status_t status;

+ if (!__efivars || !__efivars->ops)
+ return -ENOENT;
+
+ ops = __efivars->ops;
+
*size = 0;

if (down_interruptible(&efivars_lock))

I will let you know about Arend's patch as well.

Jon

--
nvpublic