All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
@ 2018-01-18  2:22 Fabio Estevam
  0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2018-01-18  2:22 UTC (permalink / raw)
  To: balbi; +Cc: jun.li, baolin.wang, peter.chen, linux-usb, Fabio Estevam

From: Fabio Estevam <fabio.estevam@nxp.com>

Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection")
causes the following kernel hang on i.MX28:

[    2.207973] usbcore: registered new interface driver usb-storage
[    2.235659] Unable to handle kernel NULL pointer dereference at virtual address 00000188
[    2.244195] pgd = (ptrval)
[    2.246994] [00000188] *pgd=00000000
[    2.250676] Internal error: Oops: 5 [#1] ARM
[    2.254979] Modules linked in:
[    2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-20180117-00002-g75d5f21 #7
[    2.266724] Hardware name: Freescale MXS (Device Tree)
[    2.271921] PC is at regmap_read+0x0/0x5c
[    2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc

mxs_phy_charger_detect() makes accesses to the anatop registers via regmap,
however i.MX23/28 do not have such registers, which causes a NULL pointer
dereference.

Fix the issue by doing a NULL check on the 'regmap' pointer.

Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Perform a NULL check on regmap (Jun Li)

 drivers/usb/phy/phy-mxs-usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index da031c4..4e2eb9d 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -602,6 +602,9 @@ static enum usb_charger_type mxs_phy_charger_detect(struct usb_phy *phy)
 	void __iomem *base = phy->io_priv;
 	enum usb_charger_type chgr_type = UNKNOWN_TYPE;
 
+	if (!regmap)
+		return UNKNOWN_TYPE;
+
 	if (mxs_charger_data_contact_detect(mxs_phy))
 		return chgr_type;
 

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

* [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
@ 2018-03-05  8:51 Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2018-03-05  8:51 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: jun.li, Baolin Wang, Peter Chen, USB list, Fabio Estevam

Fabio Estevam <festevam@gmail.com> writes:

> Hi Felipe,
>
> On Mon, Jan 22, 2018 at 10:28 AM, Fabio Estevam <festevam@gmail.com> wrote:
>> Hi Felipe,
>>
>> On Thu, Jan 18, 2018 at 12:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
>>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>>
>>> Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection")
>>> causes the following kernel hang on i.MX28:
>>>
>>> [    2.207973] usbcore: registered new interface driver usb-storage
>>> [    2.235659] Unable to handle kernel NULL pointer dereference at virtual address 00000188
>>> [    2.244195] pgd = (ptrval)
>>> [    2.246994] [00000188] *pgd=00000000
>>> [    2.250676] Internal error: Oops: 5 [#1] ARM
>>> [    2.254979] Modules linked in:
>>> [    2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-20180117-00002-g75d5f21 #7
>>> [    2.266724] Hardware name: Freescale MXS (Device Tree)
>>> [    2.271921] PC is at regmap_read+0x0/0x5c
>>> [    2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
>>>
>>> mxs_phy_charger_detect() makes accesses to the anatop registers via regmap,
>>> however i.MX23/28 do not have such registers, which causes a NULL pointer
>>> dereference.
>>>
>>> Fix the issue by doing a NULL check on the 'regmap' pointer.
>>>
>>> Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
>>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> Could this one be applied to 4.15 final so that we avoid a boot
>> regression on i.MX23/28?
>
> A gentle ping.

499350865387f8b8c40a9e9453a9a7eb3cec5dc4

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

* [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
@ 2018-02-14  1:50 Fabio Estevam
  0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2018-02-14  1:50 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: jun.li, Baolin Wang, Peter Chen, USB list, Fabio Estevam

Hi Felipe,

On Mon, Jan 22, 2018 at 10:28 AM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Felipe,
>
> On Thu, Jan 18, 2018 at 12:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection")
>> causes the following kernel hang on i.MX28:
>>
>> [    2.207973] usbcore: registered new interface driver usb-storage
>> [    2.235659] Unable to handle kernel NULL pointer dereference at virtual address 00000188
>> [    2.244195] pgd = (ptrval)
>> [    2.246994] [00000188] *pgd=00000000
>> [    2.250676] Internal error: Oops: 5 [#1] ARM
>> [    2.254979] Modules linked in:
>> [    2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-20180117-00002-g75d5f21 #7
>> [    2.266724] Hardware name: Freescale MXS (Device Tree)
>> [    2.271921] PC is at regmap_read+0x0/0x5c
>> [    2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
>>
>> mxs_phy_charger_detect() makes accesses to the anatop registers via regmap,
>> however i.MX23/28 do not have such registers, which causes a NULL pointer
>> dereference.
>>
>> Fix the issue by doing a NULL check on the 'regmap' pointer.
>>
>> Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>
> Could this one be applied to 4.15 final so that we avoid a boot
> regression on i.MX23/28?

A gentle ping.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
@ 2018-01-22 12:28 Fabio Estevam
  0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2018-01-22 12:28 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: jun.li, Baolin Wang, Peter Chen, USB list, Fabio Estevam

Hi Felipe,

On Thu, Jan 18, 2018 at 12:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection")
> causes the following kernel hang on i.MX28:
>
> [    2.207973] usbcore: registered new interface driver usb-storage
> [    2.235659] Unable to handle kernel NULL pointer dereference at virtual address 00000188
> [    2.244195] pgd = (ptrval)
> [    2.246994] [00000188] *pgd=00000000
> [    2.250676] Internal error: Oops: 5 [#1] ARM
> [    2.254979] Modules linked in:
> [    2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-20180117-00002-g75d5f21 #7
> [    2.266724] Hardware name: Freescale MXS (Device Tree)
> [    2.271921] PC is at regmap_read+0x0/0x5c
> [    2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
>
> mxs_phy_charger_detect() makes accesses to the anatop registers via regmap,
> however i.MX23/28 do not have such registers, which causes a NULL pointer
> dereference.
>
> Fix the issue by doing a NULL check on the 'regmap' pointer.
>
> Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Could this one be applied to 4.15 final so that we avoid a boot
regression on i.MX23/28?

Thanks
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
@ 2018-01-18  3:46 Jun Li
  0 siblings, 0 replies; 6+ messages in thread
From: Jun Li @ 2018-01-18  3:46 UTC (permalink / raw)
  To: Fabio Estevam, balbi; +Cc: baolin.wang, Peter Chen, linux-usb, Fabio Estevam

> -----Original Message-----
> From: Fabio Estevam [mailto:festevam@gmail.com]
> Sent: Thursday, January 18, 2018 10:23 AM
> To: balbi@kernel.org
> Cc: Jun Li <jun.li@nxp.com>; baolin.wang@linaro.org; Peter Chen
> <peter.chen@nxp.com>; linux-usb@vger.kernel.org; Fabio Estevam
> <fabio.estevam@nxp.com>
> Subject: [PATCH v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
> 
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection") causes
> the following kernel hang on i.MX28:
> 
> [    2.207973] usbcore: registered new interface driver usb-storage
> [    2.235659] Unable to handle kernel NULL pointer dereference at virtual
> address 00000188
> [    2.244195] pgd = (ptrval)
> [    2.246994] [00000188] *pgd=00000000
> [    2.250676] Internal error: Oops: 5 [#1] ARM
> [    2.254979] Modules linked in:
> [    2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-
> 20180117-00002-g75d5f21 #7
> [    2.266724] Hardware name: Freescale MXS (Device Tree)
> [    2.271921] PC is at regmap_read+0x0/0x5c
> [    2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
> 
> mxs_phy_charger_detect() makes accesses to the anatop registers via regmap,
> however i.MX23/28 do not have such registers, which causes a NULL pointer
> dereference.
> 
> Fix the issue by doing a NULL check on the 'regmap' pointer.
> 
> Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Reviewed-by: Li Jun <jun.li@nxp.com>

> ---
> Changes since v1:
> - Perform a NULL check on regmap (Jun Li)
> 
>  drivers/usb/phy/phy-mxs-usb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index da031c4..4e2eb9d 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -602,6 +602,9 @@ static enum usb_charger_type
> mxs_phy_charger_detect(struct usb_phy *phy)
>  	void __iomem *base = phy->io_priv;
>  	enum usb_charger_type chgr_type = UNKNOWN_TYPE;
> 
> +	if (!regmap)
> +		return UNKNOWN_TYPE;
> +
>  	if (mxs_charger_data_contact_detect(mxs_phy))
>  		return chgr_type;
> 
> --
> 2.7.4
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28
@ 2018-01-18  2:28 Peter Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Chen @ 2018-01-18  2:28 UTC (permalink / raw)
  To: Fabio Estevam, balbi; +Cc: Jun Li, baolin.wang, linux-usb, Fabio Estevam

> Commit e93650994a95 ("usb: phy: mxs: add usb charger type detection") causes the
> following kernel hang on i.MX28:
> 
> [    2.207973] usbcore: registered new interface driver usb-storage
> [    2.235659] Unable to handle kernel NULL pointer dereference at virtual address
> 00000188
> [    2.244195] pgd = (ptrval)
> [    2.246994] [00000188] *pgd=00000000
> [    2.250676] Internal error: Oops: 5 [#1] ARM
> [    2.254979] Modules linked in:
> [    2.258089] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-next-20180117-
> 00002-g75d5f21 #7
> [    2.266724] Hardware name: Freescale MXS (Device Tree)
> [    2.271921] PC is at regmap_read+0x0/0x5c
> [    2.275977] LR is at mxs_phy_charger_detect+0x34/0x1dc
> 
> mxs_phy_charger_detect() makes accesses to the anatop registers via regmap,
> however i.MX23/28 do not have such registers, which causes a NULL pointer
> dereference.
> 
> Fix the issue by doing a NULL check on the 'regmap' pointer.
> 
> Fixes: e93650994a95 ("usb: phy: mxs: add usb charger type detection")
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> Changes since v1:
> - Perform a NULL check on regmap (Jun Li)
> 
>  drivers/usb/phy/phy-mxs-usb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index
> da031c4..4e2eb9d 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -602,6 +602,9 @@ static enum usb_charger_type
> mxs_phy_charger_detect(struct usb_phy *phy)
>  	void __iomem *base = phy->io_priv;
>  	enum usb_charger_type chgr_type = UNKNOWN_TYPE;
> 
> +	if (!regmap)
> +		return UNKNOWN_TYPE;
> +
>  	if (mxs_charger_data_contact_detect(mxs_phy))
>  		return chgr_type;
 
Acked-by: Peter Chen <peter.chen@nxp.com>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-03-05  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18  2:22 [v2] usb: phy: mxs: Fix NULL pointer dereference on i.MX23/28 Fabio Estevam
2018-01-18  2:28 Peter Chen
2018-01-18  3:46 Jun Li
2018-01-22 12:28 Fabio Estevam
2018-02-14  1:50 Fabio Estevam
2018-03-05  8:51 Felipe Balbi

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.