[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100201173518.GA28002@ldl.fc.hp.com>
Date: Mon, 1 Feb 2010 10:35:18 -0700
From: Alex Chiang <achiang@...com>
To: lenb@...nel.org, Chris Mason <chris.mason@...cle.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: stable@...nel.org
Subject: Re: [PATCH] set dock_station->flags to zero during dock_add
Hi Chris,
Thanks for catching this. Seems better to just memset the stack
variable before we kmemdup it in platform_deivce_register_data().
How about this instead?
---
From: Alex Chiang <achiang@...com>
ACPI: dock: properly initialize local struct dock_station in dock_add()
Commit fe06fba2 (ACPI: dock: add struct dock_station * directly
to platform device data) changed dock_add() to use the
platform_device_register_data() API.
We passed that interface a stack variable, which is kmemdup'ed
and assigned to the device's platform_data pointer.
Unfortunately, whatever random garbage is in the stack variable
gets coped during the kmemdup, and that leads to broken behavior.
Explicitly zero out the structure before passing it to the API.
Cc: stable@...nel.org
Reported-by: Chris Mason <chris.mason@...cle.com>
Signed-off-by: Alex Chiang <achiang@...com>
---
Commit fe06fba2 was introduced in 2.6.32-rc5, so we need this fix
for the .32 stable series only.
---
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index bbc2c13..b2586f5 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -935,6 +935,7 @@ static int dock_add(acpi_handle handle)
struct platform_device *dd;
id = dock_station_count;
+ memset(&ds, 0, sizeof(ds));
dd = platform_device_register_data(NULL, "dock", id, &ds, sizeof(ds));
if (IS_ERR(dd))
return PTR_ERR(dd);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists