Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3668441ybl; Mon, 12 Aug 2019 04:30:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPGngSvcj5qiJBzFg0i2G1bLdr325PoQhMryoSUQyMbLORrkjSdk54FbhsJ4JgB47Fw3Ma X-Received: by 2002:a63:8a43:: with SMTP id y64mr29802941pgd.104.1565609401525; Mon, 12 Aug 2019 04:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565609401; cv=none; d=google.com; s=arc-20160816; b=s3gxDhj+X3OMQuKJiArlpm5QqkQjsDHe9JnHFmlvWgxFvkjvpuXBcjxZgsAwTpqBkI dJc4qSOO4ODdCvTC2sjdXBq11Wf60KYr9EMkuOgWD6fFGt+Y4U/hk8iHPFgDA3fs1KPT DWoKmjyPKTmfcErtRaJBL0zuZQ65Ig/buvnRR0hatvQi+xOJp5/f/w2KpWT9/3SPT4zS QkvDgC5v3Yq4PVNa5npYO323LK+4krMkgbLl7XOH+SAMNRUATTTqVKtLoyAzhX8OgEiA rl89RJ5zISXM/FvB9OXtczbQ8mcO0rg6hrC5WmqWVGtH5JxkdzYp7Zkj5bB/aKq/zYXT 09Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=ADUXU22pbKxAc6su3ZyKW+PXLicjlm3CyfngVyySigY=; b=Xo6uFv3TipRc2YZTpEq9YKIjgS9Dz8rJ98TcY4ZmdOEb6G5kIp3TA3eb5YZx3UqVr6 BlrAshGjl4KNT69TxmUZ3mMOy6mbXze3T1K1yEzdvYw9MJep0MJAU1nwPuZkNuCW6gMA /zXCnEeLXIJqUbI8XqkRQQPZACqhIXoolM8diHdMEQsic+KoXHXHvj7yOXJKbc/3qZ3I WI9FVLEm1vqbt/m1NbC+118xsmqqfhUjAZoY7hB8HQliK8MJWJqFibf+rpvVCKe2RaPW vNzspIIumhd/9crz5r/+BUe/AZdCbxDMtimCobYy8pEraznPhOICvl7l49MJ9o0k4bkD Yh9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=AAPN71YV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si54804526plp.304.2019.08.12.04.29.46; Mon, 12 Aug 2019 04:30:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=AAPN71YV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728456AbfHLL2y (ORCPT + 99 others); Mon, 12 Aug 2019 07:28:54 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:4775 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbfHLL2w (ORCPT ); Mon, 12 Aug 2019 07:28:52 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 12 Aug 2019 04:28:53 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 12 Aug 2019 04:28:51 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 12 Aug 2019 04:28:51 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 12 Aug 2019 11:28:51 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 12 Aug 2019 11:28:51 +0000 Received: from kyarlagadda-linux.nvidia.com (Not Verified[10.19.64.169]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 12 Aug 2019 04:28:50 -0700 From: Krishna Yarlagadda To: , , , , , , CC: , , , , Ahung Cheng , Krishna Yarlagadda Subject: [PATCH 04/14] serial: tegra: protect IER against LCR.DLAB Date: Mon, 12 Aug 2019 16:58:13 +0530 Message-ID: <1565609303-27000-5-git-send-email-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565609303-27000-1-git-send-email-kyarlagadda@nvidia.com> References: <1565609303-27000-1-git-send-email-kyarlagadda@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565609333; bh=ADUXU22pbKxAc6su3ZyKW+PXLicjlm3CyfngVyySigY=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=AAPN71YVilUkhMM4ZQLASP2z7l32sRtguhSU2VWXBOK7/hLj2llV8hCl7PZ+IR3ov l/23CpAoXY791yeV1Uv089//c9X94MFaQhXymycIa1jry2/N3YyXjdVQk4qVIUaByn 1GKqZBzti8q/PPEh9LdqG4h0e4oP1KvNN5nHHDSjajcN7XcBF/ZU3NoXLNRPn5WCuV IMLSU8/lC0xZv0GMthmETTJUs7K+sFnYovKV/7sl9BISOyPhOlSDz4mmDyw6GjSVny owwBuGfWElnB06LjTO/mf/oGInzwto8K4ry8M1NdNvujSviOsPyPB9hMtsWKmHGz8l 0fuNceNWr0pWg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ahung Cheng The IER and DLH registers occupy the same address space, selected by the LCR.DLAB bit. Hence, add port lock to protect IER when LCR.DLAB bit is set. Signed-off-by: Ahung Cheng Signed-off-by: Krishna Yarlagadda --- drivers/tty/serial/serial-tegra.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index d908465..ae7225c 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -296,6 +296,7 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud) unsigned long rate; unsigned int divisor; unsigned long lcr; + unsigned long flags; int ret; if (tup->current_baud == baud) @@ -315,6 +316,7 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud) divisor = DIV_ROUND_CLOSEST(rate, baud * 16); } + spin_lock_irqsave(&tup->uport.lock, flags); lcr = tup->lcr_shadow; lcr |= UART_LCR_DLAB; tegra_uart_write(tup, lcr, UART_LCR); @@ -327,6 +329,7 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud) /* Dummy read to ensure the write is posted */ tegra_uart_read(tup, UART_SCR); + spin_unlock_irqrestore(&tup->uport.lock, flags); tup->current_baud = baud; -- 2.7.4