aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-13 14:45:17 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:06 -0400
commit7b595756ec1f49e0049a9e01a1298d53a7faaa15 (patch)
treecd06687ab3e5c7a5a4ef91903dff207a18c4db76 /kernel/module.c
parentdbde0fcf9f8f6d477af3c32d9979e789ee680cde (diff)
sysfs: kill unnecessary attribute->owner
sysfs is now completely out of driver/module lifetime game. After deletion, a sysfs node doesn't access anything outside sysfs proper, so there's no reason to hold onto the attribute owners. Note that often the wrong modules were accounted for as owners leading to accessing removed modules. This patch kills now unnecessary attribute->owner. Note that with this change, userland holding a sysfs node does not prevent the backing module from being unloaded. For more info regarding lifetime rule cleanup, please read the following message. http://article.gmane.org/gmane.linux.kernel/510293 (tweaked by Greg to not delete the field just yet, to make it easier to merge things properly.) Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 9bd93de01f4a..015d60cfd90e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -488,8 +488,7 @@ static void free_modinfo_##field(struct module *mod) \
488 mod->field = NULL; \ 488 mod->field = NULL; \
489} \ 489} \
490static struct module_attribute modinfo_##field = { \ 490static struct module_attribute modinfo_##field = { \
491 .attr = { .name = __stringify(field), .mode = 0444, \ 491 .attr = { .name = __stringify(field), .mode = 0444 }, \
492 .owner = THIS_MODULE }, \
493 .show = show_modinfo_##field, \ 492 .show = show_modinfo_##field, \
494 .setup = setup_modinfo_##field, \ 493 .setup = setup_modinfo_##field, \
495 .test = modinfo_##field##_exists, \ 494 .test = modinfo_##field##_exists, \
@@ -793,7 +792,7 @@ static ssize_t show_refcnt(struct module_attribute *mattr,
793} 792}
794 793
795static struct module_attribute refcnt = { 794static struct module_attribute refcnt = {
796 .attr = { .name = "refcnt", .mode = 0444, .owner = THIS_MODULE }, 795 .attr = { .name = "refcnt", .mode = 0444 },
797 .show = show_refcnt, 796 .show = show_refcnt,
798}; 797};
799 798
@@ -851,7 +850,7 @@ static ssize_t show_initstate(struct module_attribute *mattr,
851} 850}
852 851
853static struct module_attribute initstate = { 852static struct module_attribute initstate = {
854 .attr = { .name = "initstate", .mode = 0444, .owner = THIS_MODULE }, 853 .attr = { .name = "initstate", .mode = 0444 },
855 .show = show_initstate, 854 .show = show_initstate,
856}; 855};
857 856
@@ -1032,7 +1031,6 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
1032 sattr->mattr.show = module_sect_show; 1031 sattr->mattr.show = module_sect_show;
1033 sattr->mattr.store = NULL; 1032 sattr->mattr.store = NULL;
1034 sattr->mattr.attr.name = sattr->name; 1033 sattr->mattr.attr.name = sattr->name;
1035 sattr->mattr.attr.owner = mod;
1036 sattr->mattr.attr.mode = S_IRUGO; 1034 sattr->mattr.attr.mode = S_IRUGO;
1037 *(gattr++) = &(sattr++)->mattr.attr; 1035 *(gattr++) = &(sattr++)->mattr.attr;
1038 } 1036 }
@@ -1090,7 +1088,6 @@ int module_add_modinfo_attrs(struct module *mod)
1090 if (!attr->test || 1088 if (!attr->test ||
1091 (attr->test && attr->test(mod))) { 1089 (attr->test && attr->test(mod))) {
1092 memcpy(temp_attr, attr, sizeof(*temp_attr)); 1090 memcpy(temp_attr, attr, sizeof(*temp_attr));
1093 temp_attr->attr.owner = mod;
1094 error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); 1091 error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr);
1095 ++temp_attr; 1092 ++temp_attr;
1096 } 1093 }