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=1796383816; b=NTAecuArzmYNxL0uLRIC47wpzRcRzd9IQlCXEnH+LqtunaGmk4dZk4xyDGiIVnengVE0 /QaqfpHXOjhQb1S3hiveoHo/0HnRvCzPXGDryAyEq9YKAEdCQGvyAUdi7CTDNUwM+prYw f59Y2SXPBKr3KXn8ElbFeJmq9ejX8kaQlE7sxbFGPwixuX0RF1J55/ykYnI9taFJA8LQv oy5g7xPgmgoURSRG56CnnImPonTdRhfMFVrwAf0P6VWG8eb6fQwd19RMjAacyn9qxIiMO o1Rhj0ZsKSDIoqSDEUtUKXKu8hPQThdoE05zbRZzh0pbcYh/cWBKZnM1C92t15UF9TQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383816; 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=kbo81dyAneBOKH2O0GKQRSoN5lhdinmyMlWSMxV/8tA=; b=10TVFP5UJowKMnZpdNqp/vq3Cgf8oc8u0AF5AwiUgLC0ALIwk3zmLf13i/pbnmRynW9Z z8B0xG5vKybLBhWvzo7Tl50fP/YCOI5db+nWRns1MynhxwiQs3aBMi6aF5qnUDaxwQhoV 567hD+7Uyl9B/5eeI8EOcJlyarmu+N6ObvVE6KcKGTVMlj3iXwLvm0fItm82GeOFNytZN 5B2Sub26lyUhQq6AYCMuRdh5osja1nGh0kG/aDSz7mDESeAStWKu1Vd+gYcYeKb5+RiMu PPtQ+z+CQHiv2KpiRFUND7b9eyqT7anH8JwEs5rTF2jaUbVOv5LtiX7Q7G/xIf/v4iA== 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=Ri9X0zmc; 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 1D8AA606A337; Fri, 4 Dec 2026 11:30:15 +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=Ri9X0zmc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 587411F000C2; Fri, 4 Dec 2026 11:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383815; bh=kbo81dyAneBOKH2O0GKQRSoN5lhdinmyMlWSMxV/8tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ri9X0zmcDFi6te+USHWBMrWy8e9wZ1k2W3ItftK4Q1g2FWtxQnpzPsvxBAtpG9NOf 0Ehc8iC4WY8VoYRp/5fxBuUkeOTmDfihSUnAqG/5RxFG/bK+BjcWO1DDBMpHNjzuus Xtor8JP8g0yQ8MPnuTkpB/bnKuciN2/DJ8jpjbCc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tim Douglas , Helge Deller Subject: [PATCH 6.12 380/555] fbdev: valkyriefb: keep the framebuffer mapping size fixed Date: Fri, 4 Dec 2026 19:07:03 +0900 Message-ID: <20261204100624.304116093@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: 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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tim Douglas commit fa9bebccf45571bd710b0591359b28d5354e7e7a upstream. When /dev/fb0 is mapped before a depth change, as with Xorg's fbdev driver, the mapping may be too short for the new mode. At 640x480, a full frame at 16 bpp is 600 KiB, so drawing it through the original 300 KiB mapping from 8 bpp can fault. Set smem_len to the usable video RAM by subtracting the 4 KiB offset already applied to smem_start, then keep that size across mode changes. On a Performa 6200CD using a kernel with local platform support, a write past the mapping caused a fault during an Xorg test at 16 bpp. With the corrected mapping size in the test kernel, twm and xterm were displayed successfully in Xorg at 640x480 and 16 bpp. In a test on a Quadra 630 in MAME with Linux v7.4-rc3, /dev/fb0 was mapped at 8 bpp and the depth was changed to 16 bpp with the original mapping still in place. A SIGSEGV was reported during the 16 bpp draw before the fix, and all 480 lines were drawn afterward. AI assistance was used to investigate the mapping size and draft the fix. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Tim Douglas Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/valkyriefb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/video/fbdev/valkyriefb.c +++ b/drivers/video/fbdev/valkyriefb.c @@ -510,7 +510,7 @@ static void valkyrie_init_fix(struct fb_ fix->mmio_len = sizeof(struct valkyrie_regs); fix->type = FB_TYPE_PACKED_PIXELS; fix->smem_start = p->frame_buffer_phys + 0x1000; - fix->smem_len = p->total_vram; + fix->smem_len = p->total_vram - 0x1000; fix->type_aux = 0; fix->ywrapstep = 0; @@ -523,7 +523,6 @@ static void valkyrie_init_fix(struct fb_ static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, struct fb_fix_screeninfo *fix) { - fix->smem_len = valkyrie_vram_reqd(par->vmode, par->cmode); fix->visual = (par->cmode == CMODE_8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; fix->line_length = par->vxres << par->cmode;