[PATCH 07/36] serial: imx: fix NULL dereference Oops when pdata == NULL

From: Greg Kroah-Hartman
Date: Tue Mar 02 2010 - 18:52:21 EST

From: Baruch Siach <baruch@xxxxxxxxxx>

The platform code doesn't have to provide platform data to get sensible
default behaviour from the imx serial driver.

This patch does not handle NULL dereference in the IrDA case, which still
requires a valid platform data pointer (in imx_startup()/imx_shutdown()),
since I don't know whether there is a sensible default behaviour, or
should the operation just fail cleanly.

Signed-off-by: Baruch Siach <baruch@xxxxxxxxxx>
Cc: Baruch Siach <baruch@xxxxxxxxxx>
Cc: Alan Cox <alan@xxxxxxxxxxxxxxx>
Cc: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Cc: Oskar Schirmer <os@xxxxxxxxx>
Cc: Fabian Godehardt <fg@xxxxxxxxx>
Cc: Daniel GlÃckner <dg@xxxxxxxxx>
Cc: stable <stable@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
drivers/serial/imx.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 60d665a..d00fcf8 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -1279,7 +1279,7 @@ static int serial_imx_probe(struct platform_device *pdev)
sport->use_irda = 1;

- if (pdata->init) {
+ if (pdata && pdata->init) {
ret = pdata->init(pdev);
if (ret)
goto clkput;
@@ -1292,7 +1292,7 @@ static int serial_imx_probe(struct platform_device *pdev)

return 0;
- if (pdata->exit)
+ if (pdata && pdata->exit)
@@ -1321,7 +1321,7 @@ static int serial_imx_remove(struct platform_device *pdev)


- if (pdata->exit)
+ if (pdata && pdata->exit)


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/