[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR07MB552920936C6FE0EF14FD25F1DDFC0@DM6PR07MB5529.namprd07.prod.outlook.com>
Date: Mon, 23 Nov 2020 11:24:39 +0000
From: Pawel Laszczak <pawell@...ence.com>
To: Roger Quadros <rogerq@...com>,
"peter.chen@....com" <peter.chen@....com>
CC: "balbi@...nel.org" <balbi@...nel.org>, "nm@...com" <nm@...com>,
"nsekhar@...com" <nsekhar@...com>,
"a-govindraju@...com" <a-govindraju@...com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] usb: cdns3: fix NULL pointer dereference on no platform
data
Hi,
>
>Some platforms (e.g. TI) will not have any platform data which will
>lead to NULL pointer dereference if we don't check for NULL pdata.
>
>Fixes: a284b7fd1b8f ("usb: cdns3: add quirk for enable runtime pm by default")
>Reported-by: Nishanth Menon <nm@...com>
>Signed-off-by: Roger Quadros <rogerq@...com>
Acked-by: Pawel Laszczak <pawell@...ence.com>
I see the same issue on my PCI based platform.
But I afraid that there will be some conflict with applying my CDSNP series after
applying this patch on Peter Chen branch :(
>---
> drivers/usb/cdns3/core.c | 2 +-
> drivers/usb/cdns3/host.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
>index 54d841aa626f..0f08aebce86d 100644
>--- a/drivers/usb/cdns3/core.c
>+++ b/drivers/usb/cdns3/core.c
>@@ -559,7 +559,7 @@ static int cdns3_probe(struct platform_device *pdev)
> device_set_wakeup_capable(dev, true);
> pm_runtime_set_active(dev);
> pm_runtime_enable(dev);
>- if (!(cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW))
>+ if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)))
> pm_runtime_forbid(dev);
>
> /*
>diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
>index 08103785a17a..ec89f2e5430f 100644
>--- a/drivers/usb/cdns3/host.c
>+++ b/drivers/usb/cdns3/host.c
>@@ -59,7 +59,7 @@ static int __cdns3_host_init(struct cdns3 *cdns)
> goto err1;
> }
>
>- if (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)
>+ if (cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW))
> cdns->xhci_plat_data->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
>
> ret = platform_device_add_data(xhci, cdns->xhci_plat_data,
--
Regards,
Pawel Laszczak
Powered by blists - more mailing lists