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 89F872745E; Fri, 21 Nov 2025 13:36:06 +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=1763732166; cv=none; b=CnftHWD2//4OMbAM4PrJXjQu3QOGnmINJ1Bb4wKazqph5eauhZbrxOXTvBXc4qah3QVZVqMb77TPX5spZL01nKX4Wpn/LrAirWsXd7xFjdgZlbJleeZzohFbNkIoBV6WvkPap5Pa/+Z6pb6+k4SWRDGBNNC4p3llhZA7F8mGZb4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732166; c=relaxed/simple; bh=bF8pIwj4d6CXcT1d3cB84TjOejqE5kN6sZ0+KG4ANPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nZTRxLSnJfPfby+rid0Hfk8P1UCf6WdxknpRYPeKULWTFyASGrB2OkL1azwZaHq8rRrA1dLFaFhwCOdDcvR1Jo0ybKWiSLcpuun6W1EHkCKE5NgT+k/+1ntEwV35T/BdkhovGJjgafB+M5fU22/jUL3DntPu3M0/tnQEH63ivTY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cKfkhh0I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cKfkhh0I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 152DDC4CEF1; Fri, 21 Nov 2025 13:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763732166; bh=bF8pIwj4d6CXcT1d3cB84TjOejqE5kN6sZ0+KG4ANPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKfkhh0Ii7/sco+bu6gvLcL9lfN3UhR1biTiy2uC7ACBYZvjHqxUQhjnAb7EBp6kC OWycfTM5mqTDg4n4UVVAeB7GSuUIGADqZhMYPpSXetCSBUFT1yDt66KsiwfUdJCURR 1leyrvnV/S+vgbhqADUw3kKJ5dlRgJF5srV/OsXs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+793cf822d213be1a74f2@syzkaller.appspotmail.com, Junjie Cao , Thomas Zimmermann , Helge Deller Subject: [PATCH 6.6 007/529] fbdev: bitblit: bound-check glyph index in bit_putcs* Date: Fri, 21 Nov 2025 14:05:06 +0100 Message-ID: <20251121130231.259150257@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Junjie Cao commit 18c4ef4e765a798b47980555ed665d78b71aeadf upstream. bit_putcs_aligned()/unaligned() derived the glyph pointer from the character value masked by 0xff/0x1ff, which may exceed the actual font's glyph count and read past the end of the built-in font array. Clamp the index to the actual glyph count before computing the address. This fixes a global out-of-bounds read reported by syzbot. Reported-by: syzbot+793cf822d213be1a74f2@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=793cf822d213be1a74f2 Tested-by: syzbot+793cf822d213be1a74f2@syzkaller.appspotmail.com Signed-off-by: Junjie Cao Reviewed-by: Thomas Zimmermann Signed-off-by: Helge Deller Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/bitblit.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/drivers/video/fbdev/core/bitblit.c +++ b/drivers/video/fbdev/core/bitblit.c @@ -79,12 +79,16 @@ static inline void bit_putcs_aligned(str struct fb_image *image, u8 *buf, u8 *dst) { u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + unsigned int charcnt = vc->vc_font.charcount; u32 idx = vc->vc_font.width >> 3; u8 *src; while (cnt--) { - src = vc->vc_font.data + (scr_readw(s++)& - charmask)*cellsize; + u16 ch = scr_readw(s++) & charmask; + + if (ch >= charcnt) + ch = 0; + src = vc->vc_font.data + (unsigned int)ch * cellsize; if (attr) { update_attr(buf, src, attr, vc); @@ -112,14 +116,18 @@ static inline void bit_putcs_unaligned(s u8 *dst) { u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + unsigned int charcnt = vc->vc_font.charcount; u32 shift_low = 0, mod = vc->vc_font.width % 8; u32 shift_high = 8; u32 idx = vc->vc_font.width >> 3; u8 *src; while (cnt--) { - src = vc->vc_font.data + (scr_readw(s++)& - charmask)*cellsize; + u16 ch = scr_readw(s++) & charmask; + + if (ch >= charcnt) + ch = 0; + src = vc->vc_font.data + (unsigned int)ch * cellsize; if (attr) { update_attr(buf, src, attr, vc);