Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3797124ybi; Mon, 29 Jul 2019 12:49:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqy08dA0OiXQTnC7gzRuQvf6c9pH402m01zoyEVGzSiyu5+xHIh5wJHdtziM7izVpfvoyzcy X-Received: by 2002:a65:43c2:: with SMTP id n2mr105807993pgp.110.1564429745685; Mon, 29 Jul 2019 12:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429745; cv=none; d=google.com; s=arc-20160816; b=LAta/tL3+QFGJVWtWOwHs+nj+LrLWGZ3VFhJIQ1c4San6HHqU8W9WIqLXUIesT1521 zXbfiys2AoZXQX+6u1mV+ImMlwT8MtbjbAe9bf8pXhWo6Cq3qUCLrGxG9wy/Mno232rU CJ25+V4C56p/miAA4qmsrgKzAn3pgYYUuHxHUYpnpNfnE16vdkvFMiVehM+A7F35qK06 JC/+9loE5xcbSMlqlHATy3t57TEnH4wWvlMRW1udTIWSFzRK9Vs21R31oahafo8kL6h+ SfOuRLywma+0Gidkdu6rEb7ip3NXUfYbyLODi7GiCze60lUeXpFfRFaTBv5mu8SyanMF LzCA== 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=Sf50XBxyuOIzo7SrWcG1N/JiAbiKna5VpA1R4bSfVVA=; b=RoHCujglumtshYqNHZK96dV3XZK4S8aBeRg0SmfGWOubJvK25rnplMiBoRqycQWrbY lHO4kP0J/IjOnZD6LcyxaYaRATu272wz6dglrQiGGS48ZURIUMMsXfeHnhqMHy7TkX2J BPNaVVBuORuZ2/hFGV22VkF0a3RSqv092AFyXBfA4bq73jLQx09cUe8dKA3xNvlstC+u YOqN0kdDEKEim57emLeE9zr3m0pCjNCO1ApXGItQjxh2cdWXQ6+mseWJVr0NCNDzxJtS q1Q/mjS5Y5N6PqgEC7Ct+mgQl2OxyjoH1pA1Y+im94klpBnRqgyT8GtPhsweRuFvAyrG 4bFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rfcm+isb; 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 x16si30414775pgi.312.2019.07.29.12.48.50; Mon, 29 Jul 2019 12:49:05 -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=Rfcm+isb; 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 S2390352AbfG2Tri (ORCPT + 99 others); Mon, 29 Jul 2019 15:47:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:37270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390357AbfG2Trc (ORCPT ); Mon, 29 Jul 2019 15:47:32 -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 6E92420C01; Mon, 29 Jul 2019 19:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429651; bh=MqF8HHLqzYEMhjxa/Iw6PcCVntom90MdjouzgeIFzrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rfcm+isbpG+Uzz/gE6CXrSNrO8B3pIEy/PneiZJUeBj/9aVoJOh8/yO3osJc1023H Jfl0dLafByIoLbvBn4JDcr+a7iwCWdqcGVcxI/ByshiqTaLAOjJIJHPVknkWummbfB xFUxUj1pqSri+gb6DCQmP2O6Q18fYWsy4M/zOcyA= 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 5.2 051/215] tty: serial: msm_serial: avoid system lockup condition Date: Mon, 29 Jul 2019 21:20:47 +0200 Message-Id: <20190729190749.370988457@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@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 23833ad952ba..3657a24913fc 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -383,10 +383,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