This reverts -- From 92413ae233b6e4d6dbc685871a90c8a74fc43573 Mon Sep 17 00:00:00 2001 From: Sasha Levin <sashal@kernel.org> Date: Fri, 27 Nov 2020 10:09:39 +0100 Subject: module: delay kobject uevent until after module init call From: Jessica Yu <jeyu@kernel.org> [ Upstream commit 38dc717e97153e46375ee21797aa54777e5498f3 ] -- that was added in 5.10.5 as it breaks our nvidia udev scripts: https://bugs.mageia.org/show_bug.cgi?id=28035 Proper fix for this is to review the nvidia udev stuff, but as this changes a behaviour that has been around since kernel 2.6 series, there ir no rush for now. Signed-off-by: Thomas Backlund <tmb@mageia.org> --- a/kernel/module.c +++ b/kernel/module.c @@ -1895,6 +1895,7 @@ static int mod_sysfs_init(struct module if (err) mod_kobject_put(mod); + /* delay uevent until full sysfs population */ out: return err; } @@ -1931,6 +1932,7 @@ static int mod_sysfs_setup(struct module add_sect_attrs(mod, info); add_notes_attrs(mod, info); + kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD); return 0; out_unreg_modinfo_attrs: @@ -3637,9 +3639,6 @@ static noinline int do_init_module(struc blocking_notifier_call_chain(&module_notify_list, MODULE_STATE_LIVE, mod); - /* Delay uevent until module has finished its init routine */ - kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD); - /* * We need to finish all async code before the module init sequence * is done. This has potential to deadlock. For example, a newly