From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794065192; b=PuwzxVTgTBrrUlt3DCA3bz4568LPq4RwZJD1635l036e3LjFrIOwYr0Xf+YajmJngjNn Cz/TXdi+y7vA+lAZtiDOvQ4fB46F9LC65u0tMF2eiXp2lVAVdV0WMKY/urASMJV8AlYSf OR6Rb7QfbEZPKN1w0Fe0lhqNKryQ9oSeRdeR88mQEMCZZ3Xci8AUFhydpyzR0uDEenfgR KkY8Dg4lbI7leB9nBtRCNwE0ETZuDEGNzvaWjkhLrYvkonVGkG8Ll5cNW6ApikS2F9b4L 4mI7FvCY0l156xv7O3j0yDWnQ4PHRtLXFvr746Pngk0sDQ+7QFj7X6FNaEJsmI0xiPg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794065192; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=NW/0E35H4jc9u37ojsx8nl5I/XKgNsA0rE+9KR/wBYg=; b=ck2u5ylzWlULObmoz6kTmJDtLj2ogIfSP+4Mk5zeEUHecOC/Bgvlvh0vNikcCKu6LfUQ Lv/iQIxasZyPkuOukAfatM/qnuNQQ7EvOO3m7PDClrHJBYTYV/0uwQNSGyyC7MKvhZsoI vviv6nS0wWH6qngrrMetTnXhofGcG2e7770KLiBHZv7Fi0eXWJqam2Pigshea1pbIYU4r SBTYvWKQWgZmJFsBE2RiivwZq7mV7l2+xnBahoazntOHCfj1G+37CWqxuG0FM6yqUr8Ey JlbE9Q3/MJUyxSE9BagP+AhCeAuUM6YFQCzE8P2/885eh8cpCigv4twE2bQ1K4TwCuA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=yHN7LzMo; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E439606A32E; Sat, 7 Nov 2026 15:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=yHN7LzMo Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDEE01F008A2; Sat, 7 Nov 2026 15:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794065192; bh=NW/0E35H4jc9u37ojsx8nl5I/XKgNsA0rE+9KR/wBYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yHN7LzModBrIqCqhq4bmTcUfmbCEUieCsQF+0ysrM653WDyTQ+Fy+QfOSN/HJZAtj ZDgxBhITuDp3CKgSwKeka2r640k9LYrEAEciWfriVRPSvP7zyXScFO1D5swr1nO9HM 3JZsOvu6SRty7UCPNMCmEczIBD4azh/jfPbJHh8c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yao Yiqi , Thomas Zimmermann , Helge Deller , Sasha Levin Subject: [PATCH 7.3 0976/1257] fbcon: Include font geometry in the rotated font cache Date: Sat, 7 Nov 2026 08:54:32 -0500 Message-ID: <20261107135006.313808471@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261107134939.434104957@linuxfoundation.org> References: <20261107134939.434104957@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yao Yiqi [ Upstream commit 10463bcd43495fb88ff667b2c5348200860f6bdc ] fbcon_rotate_font() caches a rotated copy of the console font and skips the rebuild when the fontdata pointer and the rotation match. Raw font data carries no geometry, though: width, height and charcount live in vc->vc_font. fbcon_set_font() deduplicates uploads by byte equality, so the same bytes re-uploaded with different dimensions keep the fontdata pointer while the geometry changes, and the early-out skips the rebuild. The rotated cell size depends on the geometry (rotation swaps width and height), so the stale buffer is indexed with the new cell size. Re-uploading a 4x16 font as 16x8 on a CW-rotated console, for example, doubles the rotated cell size and reads past the end of the old buffer. Record the geometry the buffer was built from and compare it in the early-out. The pointer-only key used to be backed by an explicit width check in the deduplication, which commit 1e3c49aa03fb ("lib/fonts: Compare font data for equality with font_data_is_equal()") dropped. Fixes: 6cc50e1c5b57 ("[PATCH] fbcon: Console Rotation - Add support to rotate font bitmap") Cc: stable@vger.kernel.org Signed-off-by: Yao Yiqi Acked-by: Thomas Zimmermann Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/core/fbcon.h | 9 ++++++--- drivers/video/fbdev/core/fbcon_rotate.c | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h index 407d207b14f16..bfbd70f8b1cdf 100644 --- a/drivers/video/fbdev/core/fbcon.h +++ b/drivers/video/fbdev/core/fbcon.h @@ -89,10 +89,13 @@ struct fbcon_par { char *cursor_data; #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION struct { - font_data_t *fontdata; /* source font */ - u8 *buf; /* rotated glyphs */ + font_data_t *fontdata; /* source font */ + u8 *buf; /* rotated glyphs */ size_t bufsize; - int buf_rotate; /* rotation of buf */ + int buf_rotate; /* rotation of buf */ + unsigned int buf_width; /* geometry of source font */ + unsigned int buf_height; + unsigned int buf_charcount; } rotated; #endif u8 *cursor_src; diff --git a/drivers/video/fbdev/core/fbcon_rotate.c b/drivers/video/fbdev/core/fbcon_rotate.c index 6cdbc96eeca6f..660a3fa81baed 100644 --- a/drivers/video/fbdev/core/fbcon_rotate.c +++ b/drivers/video/fbdev/core/fbcon_rotate.c @@ -21,11 +21,18 @@ int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc) unsigned char *buf; int ret; - if (par->p->fontdata == par->rotated.fontdata && par->rotate == par->rotated.buf_rotate) + if (par->p->fontdata == par->rotated.fontdata && + par->rotate == par->rotated.buf_rotate && + vc->vc_font.width == par->rotated.buf_width && + vc->vc_font.height == par->rotated.buf_height && + vc->vc_font.charcount == par->rotated.buf_charcount) return 0; par->rotated.fontdata = par->p->fontdata; par->rotated.buf_rotate = par->rotate; + par->rotated.buf_width = vc->vc_font.width; + par->rotated.buf_height = vc->vc_font.height; + par->rotated.buf_charcount = vc->vc_font.charcount; if (info->fbops->fb_sync) info->fbops->fb_sync(info); -- 2.53.0