Skip to content

Commit

Permalink
ACPI: dock: properly initialize local struct dock_station in dock_add()
Browse files Browse the repository at this point in the history
Commit fe06fba (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.

This fixes the T41 docking button issue:
http://bugzilla.kernel.org/show_bug.cgi?id=15000

Cc: stable@kernel.org
Reported-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Alex Chiang authored and Len Brown committed Feb 16, 2010
1 parent 724e6d3 commit 49c6fb2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/acpi/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 49c6fb2

Please sign in to comment.