From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B3A5D35A39F for ; Thu, 14 May 2026 19:26:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778786782; cv=none; b=I0sN0Q59N4Vj8lYGsDNuX2sZX/fVH6bBQ9c30D7jZBuZUW9dsjZnfsqaSfbxZbz1V/m3BS3OtIKPdDV7DSqX0APQSdZGTzRHChotm2LNhoqDcL2TXUoYzUPM9Nf6GN4WV6xVVRGJryYFn7d8co2FUjP3k4rwdnZNGgGNhwMd3rg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778786782; c=relaxed/simple; bh=E1Q97Ovnph5ZvEPJtFqMTSoFv4RektaI0JFakHaDqCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fT1BOBTvQ1Ei1qPBE/jhZvdsjYCrp11HSMdj3p3d61hEBRoTlhugKdKsgr3BcYbkun7uEdYPiK+0je1YUec86jfKUCicguVfufRMEHv5VKASAUtHR/dOjV7dfwN/ezKTgOo//A+uuDZHHywhPkbPfgPdB79OP9mYuOo6a4PEOws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AYXhKGt2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AYXhKGt2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2E69C2BCB3; Thu, 14 May 2026 19:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778786782; bh=E1Q97Ovnph5ZvEPJtFqMTSoFv4RektaI0JFakHaDqCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AYXhKGt2BwnAoSUPqMLPRxae4AheHJUzHAqvtBwE80Av7fUD0wloUkKoTmvnUUsJw PIwU6AjQSjLl36sx8sFzJMEyE/PqxRogqVEKerJ66C2/9ZhEeg/A7UBVNfJA3k1vlf PgpoSkEgsQROJzXyJ2jRv2BmYR5jLHOnhZu8tF4ws5aTfqTwn2L1zXBHeIXPpIlqj+ mmT04F5Stqunc5JF0uFeJevwUxReyh6yCY9Fum6X2zgB3aUp9oCUrOB4jDNqAVug9A 5fdqb1pectd8B5CeH9Na3marQc4mthfHNqhdonO/F66p7b4QDDmf9g+2JY7oImHDDO 43XGDqp0xgxog== From: Sasha Levin To: stable@vger.kernel.org Cc: Thomas Zimmermann , Helge Deller , Sasha Levin Subject: [PATCH 6.12.y] fbcon: Avoid OOB font access if console rotation fails Date: Thu, 14 May 2026 15:26:19 -0400 Message-ID: <20260514192619.1259876-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026051241-obituary-acts-a391@gregkh> References: <2026051241-obituary-acts-a391@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- drivers/video/fbdev/core/fbcon_rotate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbcon_rotate.c b/drivers/video/fbdev/core/fbcon_rotate.c index ec3c883400f7b..4a06e71ae4434 100644 --- 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_info *info, struct vc_data *vc) 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_info *info, struct vc_data *vc) } ops->fd_size = d_cellsize * len; - kfree(ops->fontbuffer); ops->fontbuffer = dst; } -- 2.53.0