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=1796383903; b=4iWp1eZuGpiOfGMTmUzoRCS3YkggMjVN+VIvmrsM2+vYWFPAQuhbuWLwA9RLkizCXHZp mkHYlwH9jIvXPLZhRh8vI0CzghWHM/gBz/0a4Unkz6M7DMqUK+bH1oUQStgMHEePUVWX/ +6nQC4RaiH+VrEbAiSzRgyEYQjFHNGDbIAj4+mWVBnr93RfVIlTVt98nXJyBrjD7OvEB8 p5/ECtr6bY5bna2XNjoIRUa7DsBYWmTTQC2oMsIGC+zskawURCE1JYSEtDX2G/bR4eINr OrhqThLuchCbu++ggwVl10Pq8ikWwj1+mex7LWVcrPtl25C+lzUXg1K2Lz3eOnIGkkA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383903; 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=Nt9JXp9RISTiXCA2WM/kK+tlsyZMWrAVo/3OoSGEBUE=; b=1ebnCIMZYIwVEnipuI5NuYYozfgfHvT26lfFXI+1vTvEh3XjSJhXS9ReTULAM1mtLKi5 e9g9cIgvtMizgQbT34Az/FMe8DHzaj7q/Ig/Oi6TCz0tgHL3EGxxITvyeZfShrEPmE4mj Itrl0+Ea8teTd85n9/2Q7h1zFSfPvgRs0i7FIn3FJVxaTa7QZnlQjKM1QJ24z3LKMc9Q1 2ApqsNAo2TqOVG2thkCUeenZTtlIZGpkBTZWY5g1MB3txND0SO65y7zLZebNtsQNGQVJ6 b2Hmwz/ZdULLoueemw+nTbPqGyNoqUr24ei5K7Fda9GCzcfqGIgqpQKHpnSblXVPE2w== 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=ChbdJNYO; 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 0F4BF60A3833; Fri, 4 Dec 2026 11:31:42 +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=ChbdJNYO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EC251F01D7B; Fri, 4 Dec 2026 11:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383902; bh=Nt9JXp9RISTiXCA2WM/kK+tlsyZMWrAVo/3OoSGEBUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ChbdJNYO/x0rzow43e8M7i3sUEC5gyRDn6Y3lStH8nEtGqLylp+63pwXT7CP3+8DV Ny16tj8ZM5F4zMy+KQCqGMBaugzbioC3J213ALwM54+o5Ww1wbNSlj59Tfp7heIewa d3oQpudWZK3eb35cVBKHmije7iDfA4UF8p813Q90= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, YuanZhe Liu <25031212351@stu.xidian.edu.cn>, Helge Deller Subject: [PATCH 6.12 376/555] fbdev: smscufx: allocate the size advertised in smem_len Date: Fri, 4 Dec 2026 19:06:59 +0900 Message-ID: <20261204100624.195897890@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: YuanZhe Liu <25031212351@stu.xidian.edu.cn> commit ae14fe6f367a9779e108449b4af41791bd6aaa47 upstream. ufx_realloc_framebuffer() allocates line_length * yres bytes but records PAGE_ALIGN(line_length * yres) in info->fix.smem_len. ufx_ops_set_par() clears the framebuffer by writing smem_len bytes, so the write runs past the end of the vmalloc() allocation whenever the mode size is not page aligned: BUG: KASAN: vmalloc-out-of-bounds in ufx_ops_set_par Write of size 2 at addr ffffc90005518600 Call Trace: ufx_ops_set_par ufx_usb_probe usb_probe_interface This runs from the probe path, before any client can open the device: with the fallback mode of 800x600 at 16 bpp the framebuffer is 960000 bytes and PAGE_ALIGN() adds 2560 bytes that were never allocated. Allocate the page aligned size that is published in smem_len instead, so the buffer covers every byte the driver and the framebuffer core can reach through smem_start and smem_len. Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters") Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/smscufx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -1280,9 +1280,10 @@ static int ufx_realloc_framebuffer(struc if (PAGE_ALIGN(new_len) > old_len) { /* - * Alloc system memory for virtual framebuffer + * Alloc system memory for virtual framebuffer. smem_len is + * rounded up to a page, so allocate that much as well. */ - new_fb = vmalloc(new_len); + new_fb = vmalloc(PAGE_ALIGN(new_len)); if (!new_fb) return -ENOMEM;