From patchwork Mon Dec 26 13:48:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Miao X-Patchwork-Id: 5978 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E867023E07 for ; Mon, 26 Dec 2011 13:48:38 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id BE7E6A18450 for ; Mon, 26 Dec 2011 13:48:38 +0000 (UTC) Received: by eaac11 with SMTP id c11so9057909eaa.11 for ; Mon, 26 Dec 2011 05:48:38 -0800 (PST) Received: by 10.205.132.148 with SMTP id hu20mr3891472bkc.96.1324907318527; Mon, 26 Dec 2011 05:48:38 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs149389bkc; Mon, 26 Dec 2011 05:48:38 -0800 (PST) Received: by 10.52.89.110 with SMTP id bn14mr13521206vdb.17.1324907316667; Mon, 26 Dec 2011 05:48:36 -0800 (PST) Received: from mail-vw0-f50.google.com (mail-vw0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id dp8si10555620vdc.17.2011.12.26.05.48.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Dec 2011 05:48:36 -0800 (PST) Received-SPF: pass (google.com: domain of eric.y.miao@gmail.com designates 209.85.212.50 as permitted sender) client-ip=209.85.212.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of eric.y.miao@gmail.com designates 209.85.212.50 as permitted sender) smtp.mail=eric.y.miao@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by vbbey12 with SMTP id ey12so11385162vbb.37 for ; Mon, 26 Dec 2011 05:48:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; bh=LnufXVkQKm5HCtN7ExJxgbWir4zYW8/nhmLeubjyHEI=; b=IYc1P31j2A8X0vveAVAKehAW4dI1cYJWjUoCfYDIxIBAkAVdv4luBr6wNaOO3Su5mL 1E4/2xU3muzJlfrp8yHo0B4esa4X1LnFoJJ0bSd+ekqjjg+gGKF/5j0GXh2tmDN+3jRG Skq7fO0aRgqLQfsnvruy8bVrbSOpVFAeqtmdA= Received: by 10.52.89.110 with SMTP id bn14mr13521196vdb.17.1324907316201; Mon, 26 Dec 2011 05:48:36 -0800 (PST) MIME-Version: 1.0 Sender: eric.y.miao@gmail.com Received: by 10.52.110.99 with HTTP; Mon, 26 Dec 2011 05:48:15 -0800 (PST) In-Reply-To: <1324589967-25365-1-git-send-email-eric.miao@linaro.org> References: <1324589967-25365-1-git-send-email-eric.miao@linaro.org> From: Eric Miao Date: Mon, 26 Dec 2011 21:48:15 +0800 X-Google-Sender-Auth: MDsAyrb1yH0VAfpzghadRxB_a8U Message-ID: Subject: Fwd: [PATCH] tty: serial: imx: move del_timer_sync() to avoid potential deadlock To: patches@linaro.org ---------- Forwarded message ---------- From: Eric Miao Date: Fri, Dec 23, 2011 at 5:39 AM Subject: [PATCH] tty: serial: imx: move del_timer_sync() to avoid potential deadlock To: linux-kernel Cc: linux-arm-kernel , Eric Miao , Fabio Estevam , Shawn Guo , Sascha Hauer , Greg Kroah-Hartman 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 Cc: Shawn Guo Cc: Sascha Hauer Cc: Greg Kroah-Hartman Signed-off-by: Eric Miao ---  drivers/tty/serial/imx.c |    4 ++--  1 files changed, 2 insertions(+), 2 deletions(-)         */ @@ -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 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.