2010-11-26 09:40:11

by Florian Fainelli

[permalink] [raw]
Subject: [PATCH 1/2] rdc321x-gpio: fix null pointer dereference while accessing platform_data

rdc321x-gpio currently fetches its driver specific data by using the platform_
device->platform_data pointer, this is wrong because the mfd device which
registers our platform_device has been added using mfd_add_device() which sets
the platform_device->driver_data pointer instead.

Signed-off-by: Florian Fainelli <[email protected]>
CC: [email protected]
---
This patch should be applied for the next 2.6.36 stable release.

diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c
index 2762698..897e057 100644
--- a/drivers/gpio/rdc321x-gpio.c
+++ b/drivers/gpio/rdc321x-gpio.c
@@ -135,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev)
struct rdc321x_gpio *rdc321x_gpio_dev;
struct rdc321x_gpio_pdata *pdata;

- pdata = pdev->dev.platform_data;
+ pdata = platform_get_drvdata(pdev);
if (!pdata) {
dev_err(&pdev->dev, "no platform data supplied\n");
return -ENODEV;


2010-11-26 12:15:59

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH 1/2] rdc321x-gpio: fix null pointer dereference while accessing platform_data

Hi Florian,

On Fri, Nov 26, 2010 at 10:39:54AM +0100, Florian Fainelli wrote:
> rdc321x-gpio currently fetches its driver specific data by using the platform_
> device->platform_data pointer, this is wrong because the mfd device which
> registers our platform_device has been added using mfd_add_device() which sets
> the platform_device->driver_data pointer instead.
>
> Signed-off-by: Florian Fainelli <[email protected]>
> CC: [email protected]
I'll take those 2 patches.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/

2010-11-29 07:59:35

by Wim Van Sebroeck

[permalink] [raw]
Subject: Re: [PATCH 1/2] rdc321x-gpio: fix null pointer dereference while accessing platform_data

Hi Samuel, Florian,

You also have my ACK for the watchdog driver.

Kind regards,
Wim.

> Hi Florian,
>
> On Fri, Nov 26, 2010 at 10:39:54AM +0100, Florian Fainelli wrote:
> > rdc321x-gpio currently fetches its driver specific data by using the platform_
> > device->platform_data pointer, this is wrong because the mfd device which
> > registers our platform_device has been added using mfd_add_device() which sets
> > the platform_device->driver_data pointer instead.
> >
> > Signed-off-by: Florian Fainelli <[email protected]>
> > CC: [email protected]
> I'll take those 2 patches.
>
> Cheers,
> Samuel.
>
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/