From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B7A348123A; Tue, 25 Aug 2026 13:35:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787664946; cv=none; b=r2rQQs88S6ddBnqdGAtiYYjoKLZHZzmtIlhVbHXK1YDKYbnx4OekI4Glsfc5ClKmJSztDriLZkxyRLrxQH77h+/1CzdvmtD5Uw9YytzQowloscA/OZWPgYH4FV2ymNp6QeD1ekfiHSKsJzHcdHv32q9bk19SoCjvxmCn6c1+o7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787664946; c=relaxed/simple; bh=2OKv3zdSQOVDjTCvpqe8+NmySObzyIIzJAc4xeaQUks=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PCZ9Wk3sxflPuR9g3u1SKoLUAxEExAQk6ew4yjRa4fpE/Yz8x2IyzmW5LDj9ccw1yHfePVJWMSB2ubcq3XklKLup6ICJVfogHLEAQfwnsbWgfYxEuVHjnGciu4u8vpOwt2lXnU6gf29HH+VWkudiENX6Y08NQcUPrEr0mhZxwQY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Rby82I+p; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Rby82I+p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1EB71F000E9; Tue, 25 Aug 2026 13:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787664945; bh=J5e/DkqpeiAtcZJuaMRBHrPyQjmQZkPcKWkyYK0DzUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Rby82I+pC5TZcciiRXw7L8KHJ8X3jMiN697PLOu7jZOvz/MCAhhQYc2OuWONsZ20O GmXip9mO5XBePGEUF6yx1Y0S2MO8UeW0l75PwZstN2UN/NyMMW9yip7+fGMOF5dpgB CunEC1kwOpURSgBIj2Arb1ffAfrZ1xT86YXfYd2E= 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 7.1 059/101] fbdev: Wrap user-invoked calls to fb_set_var() in helper Date: Tue, 25 Aug 2026 15:25:37 +0200 Message-ID: <20260825132544.303573413@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.986300899@linuxfoundation.org> References: <20260825132541.986300899@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.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 Stable-dep-of: 061db6b7a910 ("fbdev: serialize mode sysfs access with lock_fb_info()") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fb_chrdev.c | 6 +----- drivers/video/fbdev/core/fbcon.c | 2 -- drivers/video/fbdev/core/fbmem.c | 13 +++++++++++++ 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 | 2 ++ 7 files changed, 19 insertions(+), 18 deletions(-) --- a/drivers/video/fbdev/core/fb_chrdev.c +++ b/drivers/video/fbdev/core/fb_chrdev.c @@ -85,11 +85,7 @@ static long do_fb_ioctl(struct fb_info * 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))) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2706,7 +2706,6 @@ void fbcon_update_vcs(struct fb_info *in 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) @@ -2734,7 +2733,6 @@ int fbcon_modechange_possible(struct fb_ return 0; } -EXPORT_SYMBOL_GPL(fbcon_modechange_possible); int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -349,6 +349,19 @@ fb_set_var(struct fb_info *info, struct } 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); + static void fb_lcd_notify_blank(struct fb_info *info) { int power; --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -20,9 +20,7 @@ static int activate(struct fb_info *fb_i 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) --- a/drivers/video/fbdev/ps3fb.c +++ b/drivers/video/fbdev/ps3fb.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -830,9 +829,7 @@ static int ps3fb_ioctl(struct fb_info *i /* 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; --- 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 @@ -1768,11 +1767,9 @@ static void sh_mobile_fb_reconfig(struct 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); } /* --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -533,6 +533,8 @@ extern int fb_set_var(struct fb_info *in 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); + /* * Helpers for framebuffers in I/O memory */