Re: [PATCH v3] acpi/nfit: Fix memory corruption/Unregister mce decoder on failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rafael?

ping?  It's been almost two months ...

P.


On 05/31/2017 03:46 PM, Vishal Verma wrote:
> On 05/31, Prarit Bhargava wrote:
>> nfit_init() calls nfit_mce_register() on module load.  When the module
>> load fails the nfit mce decoder is not unregistered.  The module's
>> memory is freed leaving the decoder chain referencing junk.  This will
>> cause panics as future registrations will reference the free'd memory.
>>
>> Unregister the nfit mce decoder on module init failure.
>>
>> [v2]: register and then unregister mce handler to avoid losing mce events
>> [v3]: also cleanup nfit workqueue
>>
>> Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
>> Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>
>> Cc: Len Brown <lenb@xxxxxxxxxx>
>> Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
>> Cc: Vishal Verma <vishal.l.verma@xxxxxxxxx>
>> Cc: "Lee, Chun-Yi" <joeyli.kernel@xxxxxxxxx>
>> Cc: Linda Knippers <linda.knippers@xxxxxxx>
>> Cc: jmoyer@xxxxxxxxxx
>> Cc: lszubowi@xxxxxxxxxx
>> ---
>>  drivers/acpi/nfit/core.c |   10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> Looks good, you can add:
> Reviewed-by: Vishal Verma <vishal.l.verma@xxxxxxxxx>
> 
>>
>> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
>> index 656acb5d7166..f3c3e9d4563c 100644
>> --- a/drivers/acpi/nfit/core.c
>> +++ b/drivers/acpi/nfit/core.c
>> @@ -3043,6 +3043,8 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event)
>>  
>>  static __init int nfit_init(void)
>>  {
>> +	int ret;
>> +
>>  	BUILD_BUG_ON(sizeof(struct acpi_table_nfit) != 40);
>>  	BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 56);
>>  	BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48);
>> @@ -3070,8 +3072,14 @@ static __init int nfit_init(void)
>>  		return -ENOMEM;
>>  
>>  	nfit_mce_register();
>> +	ret = acpi_bus_register_driver(&acpi_nfit_driver);
>> +	if (ret) {
>> +		nfit_mce_unregister();
>> +		destroy_workqueue(nfit_wq);
>> +	}
>> +
>> +	return ret;
>>  
>> -	return acpi_bus_register_driver(&acpi_nfit_driver);
>>  }
>>  
>>  static __exit void nfit_exit(void)
>> -- 
>> 1.7.9.3
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux