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=1793215835; b=RqhzGNCtCoEbRj0/fNr3qeZ9J3uqr2EAhWZ4mbDR/0rzTwTM19WiXncgUtD0dwb0aJng 4iA1i7E/1AKDjg5g/CU49H1cJ9trCOZnXLdpxhRD/5nSjQv5NG/NQB71AyyRLPfntflp/ V+nRCbzAtLaUzDeQYvrsTZbOqnAmOjVUdaSe40apnJ48gZnBcbQ43lTQLxRZr87Sz/M6F ob/wV+1RLtzHXDDofb20pQcsPdBZ8GM1W5hPHk44pPDy32CQ+vKVgfS7seFqcTZOSdbyC O/4WLcpuR4O8npF+WGNUGtMPE+VJNR1QLf8ls3t/KX5MUcbJX60DbrELgPBtnyYgvlw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793215835; 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=LeP1Bn0WXFdXSqHuVD1mN8SzoAMqVYTHVI1dfVmMVGw=; b=tN9cYyTr8zWhsImRyg6SX1jb09Pl8FUY7/5CeLPvj5yLAJjFk6KlwCGB7XArxt4tiCDo 3YZfWfRxlyC+Nv7gr7LlyjNM45fFnHpf1djg+tYPTrLUHtZ4wMiekvMJUhp//U1To0/xp +Dvo1EEb0otcDpd1wSAH9agoW9POSYNcEQwJsoi5YXDz3lSAUCGvJHikXyhi4JXaP6uce XyhyrEsqqQr7g5Qu/6SSQbgm04FtawWDgjejYCTT4RAFQ3UbgsDkeuzzxGCEeugwwbkwn aq3+AnFkHhtROdHSzuw1v6ZU4mjx+CFp/TuGtmuuiD6U2qCb8ICu9nK2mJtCxmfuAkw== 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=aNnirncu; 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 A0B56606A320; Wed, 28 Oct 2026 19:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=aNnirncu Received: by smtp.kernel.org (Postfix) with ESMTPSA id F025D1F01825; Wed, 28 Oct 2026 19:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793215835; bh=LeP1Bn0WXFdXSqHuVD1mN8SzoAMqVYTHVI1dfVmMVGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aNnirncupXEx9hXX8hsrFaHXgKIPqk4tGJUlO9vEVU76Ipf4Y2KQO6mYgMR61OGog KhDATLe/RnvyWBBaagmFUEs2j9SgqpkBPMbYjlW1M8R8zrwtEpmBGGvTDeMbzCYL3n 0r+oI++xqSrtnRJmsqwLXotKynkNExQMCFK6Z9D8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Zimmermann , Helge Deller , Sasha Levin Subject: [PATCH 6.1 1348/1887] fbdev: Wrap user-invoked calls to fb_set_var() in helper Date: Wed, 28 Oct 2026 17:57:24 +0100 Message-ID: <20261028170530.115332951@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028170459.200466217@linuxfoundation.org> References: <20261028170459.200466217@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: Thomas Zimmermann [ Upstream commit 6f611e5e5f3327cf2e2daabe6ee5acac58cc784e ] Handle fbcon during display updates in fb_set_var_from_user(). Check with fbcon if the mode change is possible, update hardware state and finally update fbcon. Update all callers. Only the FBIOPUT_VSCREENINFO ioctl currently does all steps. Other mode-changes callers in sysfs and driver code are missing fbcon-related steps. With the new helper, ps3fb and sh_mobile_lcdcfb no longer maintain fbcon state themselves. Signed-off-by: Thomas Zimmermann Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/core/fbcon.c | 2 -- drivers/video/fbdev/core/fbmem.c | 19 ++++++++++++++----- drivers/video/fbdev/core/fbsysfs.c | 4 +--- drivers/video/fbdev/ps3fb.c | 5 +---- drivers/video/fbdev/sh_mobile_lcdcfb.c | 5 +---- include/linux/fb.h | 3 +++ 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 1c807473a0a08..a0a9b0b933184 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2774,7 +2774,6 @@ void fbcon_update_vcs(struct fb_info *info, bool all) else fbcon_modechanged(info); } -EXPORT_SYMBOL(fbcon_update_vcs); /* let fbcon check if it supports a new screen resolution */ int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo *var) @@ -2802,7 +2801,6 @@ int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo *va return 0; } -EXPORT_SYMBOL_GPL(fbcon_modechange_possible); int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index bd0be854b1161..c68e1c7b2c729 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1074,6 +1074,19 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) } EXPORT_SYMBOL(fb_set_var); +int fb_set_var_from_user(struct fb_info *info, struct fb_var_screeninfo *var) +{ + int ret = fbcon_modechange_possible(info, var); + + if (!ret) + ret = fb_set_var(info, var); + if (!ret) + fbcon_update_vcs(info, var->activate & FB_ACTIVATE_ALL); + + return ret; +} +EXPORT_SYMBOL(fb_set_var_from_user); + int fb_blank(struct fb_info *info, int blank) { @@ -1122,11 +1135,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, var.activate &= ~FB_ACTIVATE_KD_TEXT; console_lock(); lock_fb_info(info); - ret = fbcon_modechange_possible(info, &var); - if (!ret) - ret = fb_set_var(info, &var); - if (!ret) - fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); + ret = fb_set_var_from_user(info, &var); unlock_fb_info(info); console_unlock(); if (!ret && copy_to_user(argp, &var, sizeof(var))) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 2d93adb18d8bd..5ced9e5510c5d 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -100,9 +100,7 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) var->activate |= FB_ACTIVATE_FORCE; console_lock(); lock_fb_info(fb_info); - err = fb_set_var(fb_info, var); - if (!err) - fbcon_update_vcs(fb_info, var->activate & FB_ACTIVATE_ALL); + err = fb_set_var_from_user(fb_info, var); unlock_fb_info(fb_info); console_unlock(); if (err) diff --git a/drivers/video/fbdev/ps3fb.c b/drivers/video/fbdev/ps3fb.c index 2fe08b67eda71..ae93a23bfce9e 100644 --- a/drivers/video/fbdev/ps3fb.c +++ b/drivers/video/fbdev/ps3fb.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -828,9 +827,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, /* Force, in case only special bits changed */ var.activate |= FB_ACTIVATE_FORCE; par->new_mode_id = val; - retval = fb_set_var(info, &var); - if (!retval) - fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); + retval = fb_set_var_from_user(info, &var); console_unlock(); } break; diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 444c3ca9d4d4d..6ce0fc3e706fc 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -1770,11 +1769,9 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) var.height = ch->display.height; var.activate = FB_ACTIVATE_NOW; - if (fb_set_var(info, &var) < 0) + if (fb_set_var_from_user(info, &var) < 0) /* Couldn't reconfigure, hopefully, can continue as before */ return; - - fbcon_update_vcs(info, true); } /* diff --git a/include/linux/fb.h b/include/linux/fb.h index 5f94c58c4672e..0b128f96ec770 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -601,6 +601,9 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); extern int fb_blank(struct fb_info *info, int blank); + +int fb_set_var_from_user(struct fb_info *info, struct fb_var_screeninfo *var); + extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); -- 2.53.0