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=1796389292; b=qJarvUGUtI+1oIZPtFLi5Yw0DpZeCWphElWuySvypAhvUSdXVSTC3AbZSjoThQsdLkda oNnHoTFJi39otPvUXm9zXFd8Y9nH/AhnJEPsSFX0NplLl08UbLF26KlzH6mr2UjXysBml ybl0JSzAa2ouNdrNirxWQ6a+RE4rEc6Yf7DxArpwRZ0jPoERQArI0+clwSQCORbF+SjFP H+oGjUOanfEEKC1fBe4pzrWDgdix5iQe48/yUkkcFzulkFphN78lI4WgfVRvfg8Pb5fHc jSfKJPH/1uzhHZdtTDpcNZl/cgQkS9TpTh3bj2fIsndYc6i1/dVWGGOyWay7HZ0yGGQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389292; 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=pp6o6+MdMPtCDvCZqpaUUgYWhBS6ffck4ziG2dkVOgA=; b=1c/zlv5xu1B3lkwsliNan5oiSJ8b8aqmtHUm4c0qYt7KsKJGW5qXNSjCJEcVUVVT0yEO lI5T+xEuQ8mL3fzNdIpPtAYjRENXCPe0HSOgwyaxF7zLYFW3z/C0vWcGiVhmBJaZnxU6j O2p4uo+f+y94t9LeO6BX4nJmO7nimdMkIFiAtgCmQriIuSiBz7EcPPSoJvDCgrtHhcdvh tLvnTrn71ezQJapLKgLrSZLC2bLBI7BfcXW5t/+L61MrfLvZz/neuGdF5LHz01K+0b9Xv LqLjPxqIsulK9BvSbUWWzc5WwPVHdkdBd1S6Hd5DfM59wuDZPdnnNwA9d9dmb2aZehw== 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=c65sigg5; 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 D42CE606A322; Fri, 4 Dec 2026 13:01: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=c65sigg5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C2341F00A07; Fri, 4 Dec 2026 13:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389291; bh=pp6o6+MdMPtCDvCZqpaUUgYWhBS6ffck4ziG2dkVOgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=c65sigg5weAJxQo+9ZV42xDSblhF7yqlYKVK6I/lDDp1lzBueQpd4R9LYNtcuR2E/ KooQyjObas3F1ceeFe3020hLZFxK6tnyN5MgiGiqbDst2Sx9twCYGaZLEjQp7MDyDP 9iqTgp8Qx9Pty8SHLzoV5lX1YHWaWaSfi7Dfpstk= 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.1 0930/1059] fbdev: smscufx: allocate the size advertised in smem_len Date: Fri, 4 Dec 2026 19:07:41 +0900 Message-ID: <20261204100708.112681331@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 @@ -1319,9 +1319,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;