linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP1: ams-delta: Fix possible use of uninitialized field
@ 2018-11-07 21:30 Janusz Krzysztofik
  2018-11-08 17:25 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Janusz Krzysztofik @ 2018-11-07 21:30 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Jiri Slaby, linux-arm-kernel,
	linux-omap, linux-kernel, stable, Janusz Krzysztofik

While playing with initialization order of modem device, it has been
discovered that under some circumstances (early console init, I
believe) its .pm() callback may be called before the
uart_port->private_data pointer is initialized from
plat_serial8250_port->private_data, resulting in NULL pointer
dereference.  Fix it by checking for uninitialized pointer before using
it in modem_pm().

Fixes: aabf31737a6a ("ARM: OMAP1: ams-delta: update the modem to use regulator API")
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
---
 arch/arm/mach-omap1/board-ams-delta.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 1947bc63074e..17e0b386e1b2 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -764,6 +764,9 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
 	struct modem_private_data *priv = port->private_data;
 	int ret;
 
+	if (!priv)
+		return;
+
 	if (IS_ERR(priv->regulator))
 		return;
 
-- 
2.16.4


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

* Re: [PATCH] ARM: OMAP1: ams-delta: Fix possible use of uninitialized field
  2018-11-07 21:30 [PATCH] ARM: OMAP1: ams-delta: Fix possible use of uninitialized field Janusz Krzysztofik
@ 2018-11-08 17:25 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2018-11-08 17:25 UTC (permalink / raw)
  To: Janusz Krzysztofik
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Jiri Slaby, linux-arm-kernel,
	linux-omap, linux-kernel, stable

* Janusz Krzysztofik <jmkrzyszt@gmail.com> [181107 13:28]:
> While playing with initialization order of modem device, it has been
> discovered that under some circumstances (early console init, I
> believe) its .pm() callback may be called before the
> uart_port->private_data pointer is initialized from
> plat_serial8250_port->private_data, resulting in NULL pointer
> dereference.  Fix it by checking for uninitialized pointer before using
> it in modem_pm().

Applying into omap-for-v4.20/fixes thanks.

Tony

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

end of thread, other threads:[~2018-11-08 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 21:30 [PATCH] ARM: OMAP1: ams-delta: Fix possible use of uninitialized field Janusz Krzysztofik
2018-11-08 17:25 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).