lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1324589967-25365-1-git-send-email-eric.miao@linaro.org>
Date:	Fri, 23 Dec 2011 05:39:27 +0800
From:	Eric Miao <eric.miao@...aro.org>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
	Eric Miao <eric.miao@...aro.org>,
	Fabio Estevam <fabio.estevam@...escale.com>,
	Shawn Guo <shawn.guo@...aro.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Greg Kroah-Hartman <gregkh@...e.de>
Subject: [PATCH] tty: serial: imx: move del_timer_sync() to avoid potential deadlock

del_timer_sync() acquires its own lock and doesn't have to be nested
within the spinlock of sport->port.lock in imx_set_termios(),  which
will cause potential deadlock.  Fix this by moving it outside.

Cc: Fabio Estevam <fabio.estevam@...escale.com>
Cc: Shawn Guo <shawn.guo@...aro.org>
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Greg Kroah-Hartman <gregkh@...e.de>
Signed-off-by: Eric Miao <eric.miao@...aro.org>
---
 drivers/tty/serial/imx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 39bbce4..0f4ba21 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -904,6 +904,8 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
 			ucr2 |= UCR2_PROE;
 	}
 
+	del_timer_sync(&sport->timer);
+
 	/*
 	 * Ask the core to calculate the divisor for us.
 	 */
@@ -934,8 +936,6 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
 			sport->port.ignore_status_mask |= URXD_OVRRUN;
 	}
 
-	del_timer_sync(&sport->timer);
-
 	/*
 	 * Update the per-port timeout.
 	 */
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ