Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3815523ybi; Mon, 29 Jul 2019 13:10:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEUwJs1Yvz3ezwF07QYYfl7LhCXXMUS8lav/LROse+26y1Le7/7PWBo4jQCisREDVsEW5B X-Received: by 2002:a17:90a:20a2:: with SMTP id f31mr112540344pjg.90.1564431013883; Mon, 29 Jul 2019 13:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431013; cv=none; d=google.com; s=arc-20160816; b=iderOqqKtnJ03SpQDndaLWlwVkQKT5V5RRj+fI4o+E/86jTYc+bQnp7eCzhuBOXypu f4t/kljuJkB6civbNCnqd5HCKms/G90jDV2aaEQpKkbWsX16vKV4LTYlUrv8WS28fCfA OGKc3dYZmHdFAYUD8poi6SWUwVAoEKRsPfoGn3EVjz26DObU1Qm7sCf7sJM1xecwcHyq dyYZBpn0fB5G+ZJ3Lbjoq5fgn5Yp+gWqKjKSmQxnYK59OQ0vIRs7jbFPUEbPE1FxtmHi tkH3lUuENrZAmWvIA9y7zVqA4lxTxeBwjlTwBqPfKKv6Ou6OP4B5n+yQTYqv/uioQY89 hwFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F7LIU42lIm/W7ETaFHnskaQiYyRWKIB82RgFpZOL8PM=; b=p9ZRWQL1qwL1+fqS2nqXwebc3ITx9R7cizKFsI2Qmt+NCUGwipbh+sClMuUyC4+ry5 d1GQGRCCwNn22dJ9XtTgjDB/yT1sChWoCabp1KTjmrOqn0o3OsJEzARUtqbrPY2s6cUY e65ug2G3EfqR9wQM2JrzvxPB6tGYeoA5VI58u1G1tmkGZRKP/lBerjm7d197/8hAvzWm yd7arSppHDlofSvJ5NoYYT8qgOA0XTrUpdGO6uIwvGyhlYGyR77Nuqkcx0L0/8bPI5sa dtMX5vY5kz1bMNpD9ZrcXoXL4pDoLxHFLdPwOmoNgeeRGohiBeqHOjRM7iwX5Uqi8gSM iqKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IVITZo3v; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59si26086497plc.425.2019.07.29.13.09.59; Mon, 29 Jul 2019 13:10:13 -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=@kernel.org header.s=default header.b=IVITZo3v; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388767AbfG2Thq (ORCPT + 99 others); Mon, 29 Jul 2019 15:37:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:52580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388672AbfG2Thn (ORCPT ); Mon, 29 Jul 2019 15:37:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 707C220C01; Mon, 29 Jul 2019 19:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429062; bh=VSHmZX2f4PP+vYyojdHIQZnpILbzS3hrKjF8hbCe414=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVITZo3vL7373YcSQ8N2y4s5t22WRgE7x3QVsCBgXF+KPlxW6VogKflN8Q9141orn juRySttrzLTUO3i7JKlU2A+Px4dY4hlPg2G2v6191IyrNsui5k3FROIqQ+JrA3A142 jPsyDB6eHazbIkRQiLvKke4RlER3jJMxVNpoHBOo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Ramirez-Ortiz , Sasha Levin Subject: [PATCH 4.14 234/293] tty: serial: msm_serial: avoid system lockup condition Date: Mon, 29 Jul 2019 21:22:05 +0200 Message-Id: <20190729190842.403480532@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ba3684f99f1b25d2a30b6956d02d339d7acb9799 ] The function msm_wait_for_xmitr can be taken with interrupts disabled. In order to avoid a potential system lockup - demonstrated under stress testing conditions on SoC QCS404/5 - make sure we wait for a bounded amount of time. Tested on SoC QCS404. Signed-off-by: Jorge Ramirez-Ortiz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/msm_serial.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 716aa76abdf9..0e0ccc132ab0 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -391,10 +391,14 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base) static inline void msm_wait_for_xmitr(struct uart_port *port) { + unsigned int timeout = 500000; + while (!(msm_read(port, UART_SR) & UART_SR_TX_EMPTY)) { if (msm_read(port, UART_ISR) & UART_ISR_TX_READY) break; udelay(1); + if (!timeout--) + break; } msm_write(port, UART_CR_CMD_RESET_TX_READY, UART_CR); } -- 2.20.1