From d34b191ac19c3f0dd8946ad419b24df77b2b5817 Mon Sep 17 00:00:00 2001 From: Mukesh Kumar Savaliya Date: Tue, 14 Mar 2017 13:22:20 +0530 Subject: [PATCH] msm_serial_hs: modify uart driver to prevent race between timer calls In some of the cases when UART submits sps transfer request, BAM finishes transfer quickly. This results into deletion of Tx timeout timer from an ISR context whereas in actual timer is not yet started. In such cases del_timer and mod_timer are meeting to a race where mod_timer finds a NULL handle due to deletion by del_timer. Change the timer call sequence to submit the timer first and then do a BAM transfer. Change-Id: I1d75a43d928776eb24752fd97d0ef31e0d5b6a51 Signed-off-by: Mukesh Kumar Savaliya --- drivers/tty/serial/msm_serial_hs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index f0d5c96ac2e0..cc616d678d42 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c @@ -3,7 +3,7 @@ * MSM 7k High speed uart driver * * Copyright (c) 2008 Google Inc. - * Copyright (c) 2007-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2007-2017, The Linux Foundation. All rights reserved. * Modified: Nick Pelly * * All source code in this file is licensed under the following license @@ -1436,13 +1436,13 @@ static void msm_hs_submit_tx_locked(struct uart_port *uport) hex_dump_ipc(msm_uport, tx->ipc_tx_ctxt, "Tx", &tx_buf->buf[tx_buf->tail], (u64)src_addr, tx_count); sps_pipe_handle = tx->cons.pipe_handle; - /* Queue transfer request to SPS */ - ret = sps_transfer_one(sps_pipe_handle, src_addr, tx_count, - msm_uport, flags); /* Set 1 second timeout */ mod_timer(&tx->tx_timeout_timer, jiffies + msecs_to_jiffies(MSEC_PER_SEC)); + /* Queue transfer request to SPS */ + ret = sps_transfer_one(sps_pipe_handle, src_addr, tx_count, + msm_uport, flags); MSM_HS_DBG("%s:Enqueue Tx Cmd, ret %d\n", __func__, ret); }