From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C60134751B; Tue, 16 Jun 2026 19:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781636572; cv=none; b=o5/gjCSvnZe6e1g0oa9Tb/vatqBSs94+v7qoJRMjI3L8z2eWL/IJUBl6dZTTRCfKOEGqe+wuSiM5vmSg021btlYbxrLBmI22MhHHjgzOJljc94sRsUMvhqwqqMvRBnCW3YusLarj5apbTX5c8AgvLjGXWuI6oqgy6bXWNVYv1uw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781636572; c=relaxed/simple; bh=zhe8+OrVYw/l468fKEMtHJqgLBqOeQh63cf1/RKRuFw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a5TZOr8PoyY6vEYPqaJDwqZa7Hu6VkgP0b3Z6N3hpmF2FGTcB6WP8X5UHsl2PxOoUY69qVWCaLzVeWYSqdOk9o05z8pt2PzdzOQ9ZP/wsGWTU9aaAFPTeXvtF4/lEOf2mCOX35kGahw9wFqB1fmMC7fHfM2R/nSMkP6sAC5vBDI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p+pGVKT0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="p+pGVKT0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3DDD1F000E9; Tue, 16 Jun 2026 19:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781636571; bh=qgcxz12ptR7ZV3ASAmNdQ3gG/chXuDWyAAD9UTgPrUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=p+pGVKT0VWmso83nKCDGX44kUHG/dl/dLNLHFrYh/LedDxGkUCjvVeA6dACOwNpxz x5HqrEURDXxeNZOAZ6F4Iy3jTAxAUcNACkAHdiAn1PWL0rGC9a3A0jmp7a+N/drx8P fShuTWivV2Hy325Jc6unUdOk3NNoYDgYkWTfwOiw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Zimmermann , Helge Deller , Sasha Levin Subject: [PATCH 5.10 265/342] fbcon: Avoid OOB font access if console rotation fails Date: Tue, 16 Jun 2026 20:29:21 +0530 Message-ID: <20260616145100.612602846@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Zimmermann [ Upstream commit e4ef723d8975a2694cc90733a6b888a5e2841842 ] Clear the font buffer if the reallocation during console rotation fails in fbcon_rotate_font(). The putcs implementations for the rotated buffer will return early in this case. See [1] for an example. Currently, fbcon_rotate_font() keeps the old buffer, which is too small for the rotated font. Printing to the rotated console with a high-enough character code will overflow the font buffer. v2: - fix typos in commit message Signed-off-by: Thomas Zimmermann Fixes: 6cc50e1c5b57 ("[PATCH] fbcon: Console Rotation - Add support to rotate font bitmap") Cc: stable@vger.kernel.org # v2.6.15+ Link: https://elixir.bootlin.com/linux/v6.19/source/drivers/video/fbdev/core/fbcon_ccw.c#L144 # [1] Signed-off-by: Helge Deller [ renamed `par` to `ops` to match the 6.12 local pointer name ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbcon_rotate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/video/fbdev/core/fbcon_rotate.c +++ b/drivers/video/fbdev/core/fbcon_rotate.c @@ -46,6 +46,10 @@ static int fbcon_rotate_font(struct fb_i info->fbops->fb_sync(info); if (ops->fd_size < d_cellsize * len) { + kfree(ops->fontbuffer); + ops->fontbuffer = NULL; + ops->fd_size = 0; + dst = kmalloc_array(len, d_cellsize, GFP_KERNEL); if (dst == NULL) { @@ -54,7 +58,6 @@ static int fbcon_rotate_font(struct fb_i } ops->fd_size = d_cellsize * len; - kfree(ops->fontbuffer); ops->fontbuffer = dst; }