Re: [PATCH 3/5] ACPI, APEI, HEST Fix the unsuitable usage of platform_data

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

 



Hi, Andi,

On Tue, Sep 21, 2010 at 8:43 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> On Sun, Sep 19, 2010 at 11:00:33AM +0800, Huang Ying wrote:
>> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
>> index 343168d..1a3508a 100644
>> --- a/drivers/acpi/apei/hest.c
>> +++ b/drivers/acpi/apei/hest.c
>> @@ -137,20 +137,23 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data)
>>
>> Âstatic int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
>
> hest_hdr is a local variable on the stack.
>
>
>> +
>> + Â Â rc = platform_device_add_data(ghes_dev, &hest_hdr, sizeof(void *));
>> + Â Â if (rc)
>> + Â Â Â Â Â Â goto err;
>
> Now you put the address of that local variable in some global data structure.
>
> And then you likely return and later the access accesses random stack space?

platform_device_add_data will allocate some new memory, and copy
hest_hdr to there, so this is safe.

Best Regards,
Huang Ying
--
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