diff mbox

tty: serial: 8250: omap: fix kernel crash in suspend-to-ram

Message ID 07874d7a1a7d73ad23b02f01558632a1421b6784.1435227194.git.nsekhar@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sekhar Nori June 25, 2015, 10:15 a.m. UTC
omap_device infrastructure has a suspend_noirq hook which
runtime suspends all devices late in the suspend cycle (see
_od_suspend_noirq() in arch/arm/mach-omap2/omap_device.c)

This leads to a NULL pointer exception in 8250_omap driver
since by the time omap8250_runtime_suspend() is called, 8250_dma
driver has already set rxchan to NULL via serial8250_release_dma().

Make an explicit check to see if rxchan is NULL in
runtime_{suspend|resume} hooks to fix this.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
This applies to latest linus/master. I can rebase and
resend after -rc1 is tagged if needed.

 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Greg KH July 23, 2015, 10:25 p.m. UTC | #1
On Thu, Jun 25, 2015 at 03:45:04PM +0530, Sekhar Nori wrote:
> omap_device infrastructure has a suspend_noirq hook which
> runtime suspends all devices late in the suspend cycle (see
> _od_suspend_noirq() in arch/arm/mach-omap2/omap_device.c)
> 
> This leads to a NULL pointer exception in 8250_omap driver
> since by the time omap8250_runtime_suspend() is called, 8250_dma
> driver has already set rxchan to NULL via serial8250_release_dma().
> 
> Make an explicit check to see if rxchan is NULL in
> runtime_{suspend|resume} hooks to fix this.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> This applies to latest linus/master. I can rebase and
> resend after -rc1 is tagged if needed.

Please rebase against 4.2-rc3 and resend, I can't apply this one now as
it fails.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sekhar Nori July 24, 2015, 6:34 a.m. UTC | #2
Hi Greg,

On Friday 24 July 2015 03:55 AM, Greg Kroah-Hartman wrote:
> On Thu, Jun 25, 2015 at 03:45:04PM +0530, Sekhar Nori wrote:
>> omap_device infrastructure has a suspend_noirq hook which
>> runtime suspends all devices late in the suspend cycle (see
>> _od_suspend_noirq() in arch/arm/mach-omap2/omap_device.c)
>>
>> This leads to a NULL pointer exception in 8250_omap driver
>> since by the time omap8250_runtime_suspend() is called, 8250_dma
>> driver has already set rxchan to NULL via serial8250_release_dma().
>>
>> Make an explicit check to see if rxchan is NULL in
>> runtime_{suspend|resume} hooks to fix this.
>>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> ---
>> This applies to latest linus/master. I can rebase and
>> resend after -rc1 is tagged if needed.
> 
> Please rebase against 4.2-rc3 and resend, I can't apply this one now as
> it fails.

I had resent this patch as part of a 7 series "tty: 8250: omap:
workaround for IP errata and a bug fix", version 2 of which you have
already applied. I should have come back and noted here that this patch
can be dropped.

Apologies for the confusion caused.

Thanks,
Sekhar

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

Patch

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index dce1a23706e8..2331dd0bbe5f 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1301,7 +1301,7 @@  static int omap8250_runtime_suspend(struct device *dev)
 	}
 
 	omap8250_enable_wakeup(priv, true);
-	if (up->dma)
+	if (up->dma && up->dma->rxchan)
 		omap_8250_rx_dma(up, UART_IIR_RX_TIMEOUT);
 
 	priv->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE;
@@ -1327,7 +1327,7 @@  static int omap8250_runtime_resume(struct device *dev)
 	if (loss_cntx)
 		omap8250_restore_regs(up);
 
-	if (up->dma)
+	if (up->dma && up->dma->rxchan)
 		omap_8250_rx_dma(up, 0);
 
 	priv->latency = priv->calc_latency;