FAILED: patch "[PATCH] drivers: base: handle module_kobject creation" failed to apply to 6.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
git checkout FETCH_HEAD
git cherry-pick -x f95bbfe18512c5c018720468959edac056a17196
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025050546-oozy-nylon-220d@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f95bbfe18512c5c018720468959edac056a17196 Mon Sep 17 00:00:00 2001
From: Shyam Saini <[email protected]>
Date: Thu, 27 Feb 2025 10:49:30 -0800
Subject: [PATCH] drivers: base: handle module_kobject creation
module_add_driver() relies on module_kset list for /sys/module/<built-in-module>/drivers directory creation.
Since,
commit 96a1a2412acba ("kernel/params.c: defer most of param_sysfs_init() to late_initcall time") drivers which are initialized from subsys_initcall() or any other
higher precedence initcall couldn't find the related kobject entry
in the module_kset list because module_kset is not fully populated
by the time module_add_driver() refers it. As a consequence,module_add_driver() returns early without calling make_driver_name().
Therefore, /sys/module/<built-in-module>/drivers is never created.
Fix this issue by letting module_add_driver() handle module_kobject creation itself.
drivers/base/module.c +5 -8
@@ -42,16 +42,13 @@ int module_add_driver(struct module *mod, const struct device_driver *drv)if (mod) mk = &mod->mkobj;else if (drv->mod_name) { -struct kobject *mkobj; - -/* Lookup built-in module entry in /sys/modules */ - mkobj =kset_find_obj (module_kset, drv->mod_name); -if (mkobj) { - mk = container_of(mkobj, struct module_kobject, kobj); +/* Lookup or create built-in module entry in /sys/modules */ + mk =lookup_or_create_module_kobject (drv->mod_name); +if (mk) {/* remember our module structure */ drv->p->mkobj = mk; -/* kset_find_obj took a reference */ -kobject_put (mkobj); +/* lookup_or_create_module_kobject took a reference */ +kobject_put (&mk->kobj); } }