Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6127481iog; Thu, 23 Jun 2022 11:56:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v7KsZCLIObtxOsq7n6+IYbaeUhUvuIl33D+YUolYCu7kUhYMCHbfkjzj2bWmPlobiZvXrV X-Received: by 2002:aa7:c681:0:b0:42f:b180:bb3d with SMTP id n1-20020aa7c681000000b0042fb180bb3dmr12320820edq.191.1656010583679; Thu, 23 Jun 2022 11:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656010583; cv=none; d=google.com; s=arc-20160816; b=d6oDvtqKO/SM4KKszjBLF8SIUKd815T3V5sQnB1hvCwLLljUPMdJuLdGgemChAEKH/ oOj6S11CzR4tIGpMr3bAkwXNwvavvuFsPgAayWai4dU3vKxMhQX4HPLe/i/Vpa3TZOZz t9zFW8W1YDXVes5ZlTm524nE3HaHb0wib8flwxZqorYArv6BFLQiVY0StbHjj1JtjcTS zURRs+CCCcAili4/ij93VNo4ZqyBRBH/BYPh0tD24j45F54jYs4d/xosdd757MdUPQ+x oM0+dBr+o3E2PErE6gC23y0rYMCQOMFQWcsrVqosl75oLNXAgRdsNyhlQwvANmJRIVoJ 5kwg== 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=upCwZ+5IAt6qsNlaOcGXZF3ZOUkgOA7Pz7x2OF6Pr28=; b=lgCeN41kmZJqIcxlNZ158by53ar08J4Nq6NUkeonEqry8sGf/7VCWRGnpVett1/lvM 6oll7oq2Wv/5nfg/yEhGfb5h0Y7ak3kQf5MNaIjcT6awlbrid/OsSspE0QxfV/X57+1n tBIbTXTR4UyCWYZlznZNneo1JfpJYbcX8rYz1Qy7iZWtqdQ0MGq1Ax2xtRmq8YEWrfvD 5JTW9qy9QtwqsgYzLt5FvcMCH9bwka+U6G7a2uGXkdD63NA4SvA6iiMZbzLB9BbGlwhb /n0p696atTMTrfdMaM3/I3yvDoGA1/zLlIVD+2SeoQYZ394mkWFb8vGMrlpZ+Zvsb6VQ 7gXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QZvYQuHh; 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 f19-20020a50d553000000b0042b370f9819si334515edj.552.2022.06.23.11.55.58; Thu, 23 Jun 2022 11:56:23 -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=QZvYQuHh; 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 S237113AbiFWSVb (ORCPT + 99 others); Thu, 23 Jun 2022 14:21:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237194AbiFWSR7 (ORCPT ); Thu, 23 Jun 2022 14:17:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E011B2CE3; Thu, 23 Jun 2022 10:24:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id AC35DB82497; Thu, 23 Jun 2022 17:24:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA480C385A5; Thu, 23 Jun 2022 17:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005060; bh=wXfswAKxoB6qEeTTPf176jRBdlVA4NxvQhEMTOE3Kqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZvYQuHhplZRe3kOXG3ecjBboBgTGO11QvIP1x71gSMhQO0pIoaW5xCqGw8k8A1ms bcomcn4Lln8KF1kxXM/BFWmgLNAnit+WGTtMf92zdLRW6T4OZsVh3xrqH3dXhOx8F4 hKoQOoz5aYf57PILuKoUtxP5STUSXKlsFLdgG/do= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 4.19 216/234] serial: 8250: Store to lsr_save_flags after lsr read Date: Thu, 23 Jun 2022 18:44:43 +0200 Message-Id: <20220623164349.162997301@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@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=-7.7 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: Ilpo Järvinen commit be03b0651ffd8bab69dfd574c6818b446c0753ce upstream. Not all LSR register flags are preserved across reads. Therefore, LSR readers must store the non-preserved bits into lsr_save_flags. This fix was initially mixed into feature commit f6f586102add ("serial: 8250: Handle UART without interrupt on TEMT using em485"). However, that feature change had a flaw and it was reverted to make room for simpler approach providing the same feature. The embedded fix got reverted with the feature change. Re-add the lsr_save_flags fix and properly mark it's a fix. Link: https://lore.kernel.org/all/1d6c31d-d194-9e6a-ddf9-5f29af829f3@linux.intel.com/T/#m1737eef986bd20cf19593e344cebd7b0244945fc Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250") Cc: stable Acked-by: Uwe Kleine-König Signed-off-by: Uwe Kleine-König Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/f4d774be-1437-a550-8334-19d8722ab98c@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_port.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1522,6 +1522,8 @@ static inline void __stop_tx(struct uart if (em485) { unsigned char lsr = serial_in(p, UART_LSR); + p->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; + /* * To provide required timeing and allow FIFO transfer, * __stop_tx_rs485() must be called only when both FIFO and