]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fbdev: Use device_create_with_groups() to fix sysfs groups registration race
authorHans de Goede <johannes.goede@oss.qualcomm.com>
Sun, 21 Dec 2025 16:57:40 +0000 (17:57 +0100)
committerHelge Deller <deller@gmx.de>
Sat, 14 Feb 2026 10:07:12 +0000 (11:07 +0100)
commit68eeb0871e986ae5462439dae881e3a27bcef85f
tree285d66aadc089693d06e9747b9d5b4118ec6c49d
parent120adae7b42faa641179270c067864544a50ab69
fbdev: Use device_create_with_groups() to fix sysfs groups registration race

The fbdev sysfs attributes are registered after sending the uevent for
the device creation, leaving a race window where e.g. udev rules may
not be able to access the sysfs attributes because the registration is
not done yet.

Fix this by switching to device_create_with_groups(). This also results in
a nice cleanup. After switching to device_create_with_groups() all that
is left of fb_init_device() is setting the drvdata and that can be passed
to device_create[_with_groups]() too. After which fb_init_device() can
be completely removed.

Dropping fb_init_device() + fb_cleanup_device() in turn allows removing
fb_info.class_flag as they were the only user of this field.

Fixes: 5fc830d6aca1 ("fbdev: Register sysfs groups through device_add_group")
Cc: stable@vger.kernel.org
Cc: Shixiong Ou <oushixiong@kylinos.cn>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/core/fbsysfs.c
include/linux/fb.h