summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-01-06 19:36:56 +0400
committerAlejandro Mery <amery@geeks.cl>2013-01-14 14:35:49 +0400
commit2ed91d356935e516b0b8c52d5e919c77b59b09fc (patch)
tree31c3741b7f7bdaf27d9922836bdd455462794346
parentc46feed4817c1a37bb48d8a239bd8068be76fc88 (diff)
downloadlinux-sunxi-2ed91d356935e516b0b8c52d5e919c77b59b09fc.tar.xz
sunxi-serial: Fix bad pointer access in sw_serial_pm
The sunxi-serial code assumes that the struct uart_port *port parameter passed to the pm callback it the address of the struct it used to register. But this is completely wrong! The argument passed to serial8250_register_port is only a template, it is copied not used directly. Instead store the correct address in port->private_data and use that. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rwxr-xr-xdrivers/tty/serial/8250_sunxi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250_sunxi.c b/drivers/tty/serial/8250_sunxi.c
index efd54e5a878a..8709e4cd2bc5 100755
--- a/drivers/tty/serial/8250_sunxi.c
+++ b/drivers/tty/serial/8250_sunxi.c
@@ -153,7 +153,7 @@ static void
sw_serial_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate)
{
- struct sw_serial_port *up = (struct sw_serial_port *)port;
+ struct sw_serial_port *up = port->private_data;
if (!state)
clk_enable(up->clk);
@@ -186,6 +186,7 @@ sw_serial_probe(struct platform_device *dev)
}
platform_set_drvdata(dev, sport);
+ sport->port.private_data = sport;
sport->port.irq = sport->irq;
sport->port.fifosize= 64;
sport->port.regshift= 2;