Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp446718iog; Mon, 13 Jun 2022 06:09:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3HRbCOgEMq6rl+oYg0UcQDgPDPGaMpSyCIW/sAfcFXm98c2pDw7RUi/wHol5SYa4JbRBX X-Received: by 2002:a05:6402:703:b0:42d:d347:a586 with SMTP id w3-20020a056402070300b0042dd347a586mr66166552edx.316.1655125641583; Mon, 13 Jun 2022 06:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125641; cv=none; d=google.com; s=arc-20160816; b=g5RHBsfBKCaddQXvu+W8fUvEQQ2hWnw+ifiMjWKacRQ+qp5NNGQqLtpNLNvCdpqaVJ 3PYIEyxSWr0lEjHaY+yjigPl3cSsQKde+HdwJivhHJIAmus35GlBuxCDi/udd2+83BvB vI7ez1HLbSxkwDyknrLVC1CoOHhp3GxOJ5l5WSfngmTXDQIJP6T1ELBrmMAFux/Z6XnD E1rNyOgn4ET7IBM4MA4ZsZXdfitpxmkgf3YspkifsRIKOBHJZWmssSaF4UYxs7GLpQE4 1W7ClEcC2H6DBhON952EX2FMIkM5iqnuZg8ueT1KDdOWQGpli+yZ/Sd2x6EGohHI2aTD DJ4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t+R2Dk1t9w7mH0+zryOdCsbRfRQ3lB1JYYByGrFnVRE=; b=Dxoz/6kYPf0qoCBJgUsEfMJ+RhVrqFiXSIm4mC+uLJSFl+GkGTwn4P8cn7ucNrFfka GH5dkMPUKOOFMkH7811RSb6LRlVPs6rjltCJcebZL8P+XDars4Zc92oOAxjVFke92hO3 x0AddWo3kUlV93btLidwWCXg1GSN1z4V7KKGAbMONxSiNR7/DWNuluGLr8UfdbZ7rPYP HQ81mB5r0OToeQRklkb/BVfSaPuatsX5JA0OsYdpf7OBJNMxQ7XcLD8hjMLjGRIqXDZY 4vVVIo5/bIIB2hPRmM9mUZTo0KxL8J3bwQ5S2Z5LdW4IdnwjFta/lxDS3ZuZzzhZ2tBC C05w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=keY6wtiQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170906644700b006fec459b41esi6305238ejn.541.2022.06.13.06.06.53; Mon, 13 Jun 2022 06:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=keY6wtiQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351642AbiFMLJs (ORCPT + 99 others); Mon, 13 Jun 2022 07:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351861AbiFMLFK (ORCPT ); Mon, 13 Jun 2022 07:05:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7EC027FDE; Mon, 13 Jun 2022 03:34:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7473A61016; Mon, 13 Jun 2022 10:34:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88A3DC34114; Mon, 13 Jun 2022 10:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116461; bh=dhBkq9o/krAgO1SYEui+pCMcu2noGqrumSdoatVq+5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keY6wtiQrpXp/Vy6dumpauKnzdLFPCagrHWaM4vZDFPegd31DdV/KcqTi0YrssljM JBxuNUolTMv0H0Be3JZqeJ5hSFEaxCSoVFXIT80Go3T52M7fqNEd2UqJKLeNU5nhm8 BJLdnserN+ZYR2b/C52nVRoRjtooSP5L2oJcdSnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Petr Mladek , John Ogness , Sasha Levin Subject: [PATCH 4.14 195/218] serial: msm_serial: disable interrupts in __msm_console_write() Date: Mon, 13 Jun 2022 12:10:53 +0200 Message-Id: <20220613094926.533746364@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Ogness [ Upstream commit aabdbb1b7a5819e18c403334a31fb0cc2c06ad41 ] __msm_console_write() assumes that interrupts are disabled, but with threaded console printers it is possible that the write() callback of the console is called with interrupts enabled. Explicitly disable interrupts using local_irq_save() to preserve the assumed context. Reported-by: Marek Szyprowski Reviewed-by: Petr Mladek Signed-off-by: John Ogness Link: https://lore.kernel.org/r/20220506213324.470461-1-john.ogness@linutronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/msm_serial.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 7848e9455950..3df3716caa56 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -1587,6 +1587,7 @@ static inline struct uart_port *msm_get_port_from_line(unsigned int line) static void __msm_console_write(struct uart_port *port, const char *s, unsigned int count, bool is_uartdm) { + unsigned long flags; int i; int num_newlines = 0; bool replaced = false; @@ -1604,6 +1605,8 @@ static void __msm_console_write(struct uart_port *port, const char *s, num_newlines++; count += num_newlines; + local_irq_save(flags); + if (port->sysrq) locked = 0; else if (oops_in_progress) @@ -1649,6 +1652,8 @@ static void __msm_console_write(struct uart_port *port, const char *s, if (locked) spin_unlock(&port->lock); + + local_irq_restore(flags); } static void msm_console_write(struct console *co, const char *s, -- 2.35.1