Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4572680imu; Tue, 29 Jan 2019 04:02:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN6UprBihydIXk0RWmUkGqE2cRZ3n0F1P1ITDbN9PR+SJLCQk5m7KA7ohhC+CG4BE9YiDyUZ X-Received: by 2002:a62:178f:: with SMTP id 137mr25648671pfx.226.1548763373063; Tue, 29 Jan 2019 04:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548763373; cv=none; d=google.com; s=arc-20160816; b=XTUb7cBloiuTZ3aqYAx7U5m2gP8SNhffpZEEAke+bofJNfGH0HbBwq1ACBlqJgamtO SvigvJMBmPpBFvTH22wUGhDpbVzeA4tRbCsuUGwnhIoHdxHLw9B559dlkkYTY87Bm1+F 9M4qkVZRaMcm90Ao8KAX4nAbIeHvNoLstRtnOr7210otCLETiy9EYcLjAYR5S5p1RZnS 9ixViVya2b7lvhoBlsQrm8djxxMyCJtlP62GhvBGK4FWFNaEitQ3OLG71VFSKUfzOAMF rRhVyKJIs7WCW6s0/1NCMwuVGy2+bE8cNv6Rh1Yedvx7imuxrtUg/ZOn5dVQuvc7tPIC CfMA== 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=m9AA3PIl+/wOkLVhbMmaKIlbanEvJX5KrGXxvXMn28I=; b=CmRm+4o/taL/aapHtptfrAA3hPNV1n1sKeK4qE8MlAjsNVDaoyFVFk/mMEueS5maNi cuKVwFsHl9ZU92F+wKzNTQpa1+1uAFRnoWwICmlag9pLEJnI95MJ4hhQi8lJE/f4/iAZ 3CmUZrsT+zqaQgnUICbf7hI2uoJ0R4ONmmicHR9ysnk6ykrFlZmhMsA++8qSS46Rclcp CCtlIMnjWa85/FrZgMUBSAHvOZ9InNGxwI69aOlm7Gsxw7S12867K8xHa7Zj/Jt4PAGr VtPrZC95EVLABX81CkqPgsFeHaLW1+O9qbIxcZLrWNHQnS0yhJTm+T4wj4EBblidnBWx xMmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OkoHtHty; 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 k14si2366454pll.346.2019.01.29.04.02.36; Tue, 29 Jan 2019 04:02:53 -0800 (PST) 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=OkoHtHty; 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 S1730656AbfA2MCc (ORCPT + 99 others); Tue, 29 Jan 2019 07:02:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:35088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730617AbfA2Lom (ORCPT ); Tue, 29 Jan 2019 06:44:42 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 7C4FA2086C; Tue, 29 Jan 2019 11:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762282; bh=3nyf6i8YIg8GouFECqnZsA38nkPEJu/v3D7IKDaRiLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OkoHtHtyVp8deJTPOnIN34SIiFIsD2ZHU+qdVzyuZe1AwCKjglgmhwgpLWXoTmjno Wc8MFK9kzv8z9oGmELEBN1Tg70RW56pxLLo8WvXx1wNBvse9uInmbyHDCSVinL7poO uP+rwSs7iPEpT93qYNVarPcr2uphk6rTBm6Dj75E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Pitre Subject: [PATCH 4.19 052/103] vgacon: unconfuse vc_origin when using soft scrollback Date: Tue, 29 Jan 2019 12:35:29 +0100 Message-Id: <20190129113202.872393686@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113159.567154026@linuxfoundation.org> References: <20190129113159.567154026@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolas Pitre commit bfd8d8fe98b8792f362cd210a7873969f8d2fc04 upstream. When CONFIG_VGACON_SOFT_SCROLLBACK is selected, the VGA display memory index and vc_visible_origin don't change when scrollback is activated. The actual screen content is saved away and the scrollbackdata is copied over it. However the vt code, and /dev/vcs devices in particular, still expect vc_origin to always point at the actual screen content not the displayed scrollback content. So adjust vc_origin to point at the saved screen content when scrollback is active and set it back to vc_visible_origin when restoring the screen. This fixes /dev/vcsa that return scrollback content when they shouldn't (onli /dev/vcsa without a number should), and also fixes /dev/vcsu that should return scrollback content when scrollback is active but currently doesn't. An unnecessary call to vga_set_mem_top() is also removed. Signed-off-by: Nicolas Pitre Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Greg Kroah-Hartman --- drivers/video/console/vgacon.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -271,6 +271,7 @@ static void vgacon_scrollback_update(str static void vgacon_restore_screen(struct vc_data *c) { + c->vc_origin = c->vc_visible_origin; vgacon_scrollback_cur->save = 0; if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { @@ -287,8 +288,7 @@ static void vgacon_scrolldelta(struct vc int start, end, count, soff; if (!lines) { - c->vc_visible_origin = c->vc_origin; - vga_set_mem_top(c); + vgacon_restore_screen(c); return; } @@ -298,6 +298,7 @@ static void vgacon_scrolldelta(struct vc if (!vgacon_scrollback_cur->save) { vgacon_cursor(c, CM_ERASE); vgacon_save_screen(c); + c->vc_origin = (unsigned long)c->vc_screenbuf; vgacon_scrollback_cur->save = 1; } @@ -335,7 +336,7 @@ static void vgacon_scrolldelta(struct vc int copysize; int diff = c->vc_rows - count; - void *d = (void *) c->vc_origin; + void *d = (void *) c->vc_visible_origin; void *s = (void *) c->vc_screenbuf; count *= c->vc_size_row;