All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle
@ 2021-09-20 11:58 Fabio Estevam
  2021-09-20 13:38 ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2021-09-20 11:58 UTC (permalink / raw)
  To: peter.chen; +Cc: shawnguo, marex, linux-usb, heiko.thiery, Fabio Estevam

Since commit 78e80c4b4238 ("arm64: dts: imx8m: Replace deprecated
fsl,usbphy DT props with phys") the following NULL pointer dereference
is observed on a Kontron i.MX8MM N801X S board:

[    1.489344] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000098
[    1.498170] Mem abort info:
[    1.500966]   ESR = 0x96000044
[    1.504030]   EC = 0x25: DABT (current EL), IL = 32 bits
[    1.509356]   SET = 0, FnV = 0
[    1.512416]   EA = 0, S1PTW = 0
[    1.515569]   FSC = 0x04: level 0 translation fault
[    1.520458] Data abort info:
[    1.523349]   ISV = 0, ISS = 0x00000044
[    1.527196]   CM = 0, WnR = 1
[    1.530176] [0000000000000098] user address but active_mm is swapper
[    1.536544] Internal error: Oops: 96000044 [#1] PREEMPT SMP
[    1.542125] Modules linked in:
[    1.545190] CPU: 3 PID: 7 Comm: kworker/u8:0 Not tainted 5.14.0-dirty #3
[    1.551901] Hardware name: Kontron i.MX8MM N801X S (DT)
[    1.557133] Workqueue: events_unbound deferred_probe_work_func
[    1.562984] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[    1.568998] pc : imx7d_charger_detection+0x3f0/0x510
[    1.573973] lr : imx7d_charger_detection+0x22c/0x510

Fix the problem by also searching for the 'phys' phandle.

Fixes: 78e80c4b4238 ("arm64: dts: imx8m: Replace deprecated fsl,usbphy DT props with phys")
Reported-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/usb/chipidea/ci_hdrc_imx.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 8b7bc10b6e8b..9d6954c71280 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -427,6 +427,17 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 			goto err_clk;
 	}
 
+	if (!data->phy) {
+		data->phy = devm_usb_get_phy_by_phandle(dev, "phys", 0);
+		if (IS_ERR(data->phy)) {
+			ret = PTR_ERR(data->phy);
+			if (ret == -ENODEV)
+				data->phy = NULL;
+			else
+				goto err_clk;
+		}
+	}
+
 	pdata.usb_phy = data->phy;
 	if (data->usbmisc_data)
 		data->usbmisc_data->usb_phy = data->phy;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle
  2021-09-20 11:58 [PATCH] usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle Fabio Estevam
@ 2021-09-20 13:38 ` Marek Vasut
  2021-09-20 14:02   ` Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2021-09-20 13:38 UTC (permalink / raw)
  To: Fabio Estevam, peter.chen; +Cc: shawnguo, linux-usb, heiko.thiery

On 9/20/21 1:58 PM, Fabio Estevam wrote:
> Since commit 78e80c4b4238 ("arm64: dts: imx8m: Replace deprecated
> fsl,usbphy DT props with phys") the following NULL pointer dereference
> is observed on a Kontron i.MX8MM N801X S board:
> 
> [    1.489344] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000098
> [    1.498170] Mem abort info:
> [    1.500966]   ESR = 0x96000044
> [    1.504030]   EC = 0x25: DABT (current EL), IL = 32 bits
> [    1.509356]   SET = 0, FnV = 0
> [    1.512416]   EA = 0, S1PTW = 0
> [    1.515569]   FSC = 0x04: level 0 translation fault
> [    1.520458] Data abort info:
> [    1.523349]   ISV = 0, ISS = 0x00000044
> [    1.527196]   CM = 0, WnR = 1
> [    1.530176] [0000000000000098] user address but active_mm is swapper
> [    1.536544] Internal error: Oops: 96000044 [#1] PREEMPT SMP
> [    1.542125] Modules linked in:
> [    1.545190] CPU: 3 PID: 7 Comm: kworker/u8:0 Not tainted 5.14.0-dirty #3
> [    1.551901] Hardware name: Kontron i.MX8MM N801X S (DT)
> [    1.557133] Workqueue: events_unbound deferred_probe_work_func
> [    1.562984] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
> [    1.568998] pc : imx7d_charger_detection+0x3f0/0x510
> [    1.573973] lr : imx7d_charger_detection+0x22c/0x510
> 
> Fix the problem by also searching for the 'phys' phandle.
> 
> Fixes: 78e80c4b4238 ("arm64: dts: imx8m: Replace deprecated fsl,usbphy DT props with phys")

Shouldn't this really fix some older commit, since this fixes NULL 
pointer dereference in the driver which got exposed by passing in a 
valid DT ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle
  2021-09-20 13:38 ` Marek Vasut
@ 2021-09-20 14:02   ` Fabio Estevam
  2021-09-20 14:16     ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2021-09-20 14:02 UTC (permalink / raw)
  To: Marek Vasut; +Cc: peter.chen, Shawn Guo, USB list, Heiko Thiery

Hi Marek,

On Mon, Sep 20, 2021 at 10:38 AM Marek Vasut <marex@denx.de> wrote:

> Shouldn't this really fix some older commit, since this fixes NULL
> pointer dereference in the driver which got exposed by passing in a
> valid DT ?

You are right. The recommendation to use 'phys' is much older and it comes
from 9d062b9b4168 ("dt-bindings: Consolidate ChipIdea USB ci13xxx bindings").

Peter, what commit do you think is appropriate for the Fixes tag in this case?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle
  2021-09-20 14:02   ` Fabio Estevam
@ 2021-09-20 14:16     ` Marek Vasut
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2021-09-20 14:16 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: peter.chen, Shawn Guo, USB list, Heiko Thiery

On 9/20/21 4:02 PM, Fabio Estevam wrote:
> Hi Marek,
> 
> On Mon, Sep 20, 2021 at 10:38 AM Marek Vasut <marex@denx.de> wrote:
> 
>> Shouldn't this really fix some older commit, since this fixes NULL
>> pointer dereference in the driver which got exposed by passing in a
>> valid DT ?
> 
> You are right. The recommendation to use 'phys' is much older and it comes
> from 9d062b9b4168 ("dt-bindings: Consolidate ChipIdea USB ci13xxx bindings").
> 
> Peter, what commit do you think is appropriate for the Fixes tag in this case?

I don't think the Fixes: should be for any dt-bindings patch, it should 
be for a patch which added the code with missing NULL pointer check into 
the CI HDRC driver.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-20 14:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 11:58 [PATCH] usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle Fabio Estevam
2021-09-20 13:38 ` Marek Vasut
2021-09-20 14:02   ` Fabio Estevam
2021-09-20 14:16     ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.