public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Andrew Liu <shengping.liu@windriver•com>
To: grant.likely@secretlab•ca, tnt@246tnt•com
Cc: linuxppc-dev <linuxppc-dev@ozlabs•org>
Subject: [PATCH]  Fix a potential issue in mpc52xx uart driver
Date: Tue, 29 Apr 2008 16:36:25 +0900	[thread overview]
Message-ID: <4816CFF9.5030505@windriver.com> (raw)

mpc52xx_uart_int and __uart_put_char both try to acquire the
port->lock. Therefore the function sequence of:

mpc52xx_uart_int--> ...-->flush_to_ldisc-->...-->__uart_put_char

can potentially trigger a deadlock. To avoid this deadlock a fix
similar to that found in the 8250.c serial driver is applied. The
deadlock is avoided by releasing the lock before pushing a buffer
and reacquiring it when completed.

Signed-off-by: Andrew Liu <shengping.liu@windriver•com>

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index d93b357..5f95e53 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -783,7 +783,9 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
                 }
         }

+       spin_unlock(&port->lock);
         tty_flip_buffer_push(tty);
+       spin_lock(&port->lock);

         return psc_ops->raw_rx_rdy(port);
  }

             reply	other threads:[~2008-04-29 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-29  7:36 Andrew Liu [this message]
2008-05-01 18:07 ` [PATCH] Fix a potential issue in mpc52xx uart driver Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4816CFF9.5030505@windriver.com \
    --to=shengping.liu@windriver$(echo .)com \
    --cc=grant.likely@secretlab$(echo .)ca \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=tnt@246tnt$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox