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=1796380895; b=iEbSxwFRmYhwhLeET5qGVU3ZFJE6r1PdZEubaM5TejGdMS0o5Kvj/mqUZL6TAC3HOnZu T1Zs4+9atZaa+N6/CPGOtAaUUXWlZHaQMNzJ9TnxbtKEFPZZA1y614baTTzjffaoCP6rI hcntt4V/nTY/Qna2WNXUT4CNwVSacLw9evZAWTT2PQbPkG7z7v1aJS8Bchxqfli+c0dm5 /+n71ENc6b4nNrVnyajU7A1nUx27Vk6XwUEfMHH1enT3hDllx4v2pjlpEGn7V+s8JndB+ cYFhtAok82ndXu8KiP44K0nhdpAK0bK+ZJF6RjbYe066R8XNhzOG1Oke+URTGcbDGVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380895; 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=4rIIjZGD4vIxz65rnFHo0yF9FBMykfC/UcJzkxzzy60=; b=Y3j5E/le2WrLdA/EV1b3gsVK2UpB0UDE+66HmJc5KBxOvoMzBJPpZCRzNZey8oXNiVBA cJ+RnKdmm0HQAR5fG8QFtLTLXc6Ai/f2Iwd2wTWQ0fAGctHbZaT9Mkp4UO4AaL1Sl5XeM TDBFTgQZdMkM6Cq6F2LE6+7YurNJr3gBMaCxOmmjxMJ2x12Zg28eLNeVJbHB85Qca3msW ApfarKUkmrSmaos1RVAYeMKJ1/pg5WyGo6iSI3zt6IYmUSMiOHqZ7Zkr2NSiKRr9G6zbI c8ALa9uK2zp4ho0NIS7ap85ESFXdFHm9mVwEv8IVzgYo9PpJccNLihUVTOsfu7OCFdQ== 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=IrPrcacK; 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 6F20E606A333; Fri, 4 Dec 2026 10:41:35 +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=IrPrcacK Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFBF11F000C2; Fri, 4 Dec 2026 10:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380895; bh=4rIIjZGD4vIxz65rnFHo0yF9FBMykfC/UcJzkxzzy60=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IrPrcacKnpFZkXIIpuU70krOBzWZRQ63ykEQZT6Eu0rEW0jvkRHKVi6KMAgNbsrNL Rex4fXfS7cj7ckdyh5+UAreI2FJE1+gkX7T5YvMcoQWekS8RXJST6ggj3/k4H0qpQC 1ZL8wqbnLJSpt0/WPjeR9vwKCMmNF9bIH9nnUXz4= 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 7.3 469/742] fbdev: smscufx: allocate the size advertised in smem_len Date: Fri, 4 Dec 2026 19:05:33 +0900 Message-ID: <20261204100647.613482153@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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;