mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
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>
This commit is contained in:
parent
dbde0fcf9f
commit
7b595756ec
55 changed files with 44 additions and 135 deletions
|
@ -488,8 +488,7 @@ static void free_modinfo_##field(struct module *mod) \
|
|||
mod->field = NULL; \
|
||||
} \
|
||||
static struct module_attribute modinfo_##field = { \
|
||||
.attr = { .name = __stringify(field), .mode = 0444, \
|
||||
.owner = THIS_MODULE }, \
|
||||
.attr = { .name = __stringify(field), .mode = 0444 }, \
|
||||
.show = show_modinfo_##field, \
|
||||
.setup = setup_modinfo_##field, \
|
||||
.test = modinfo_##field##_exists, \
|
||||
|
@ -793,7 +792,7 @@ static ssize_t show_refcnt(struct module_attribute *mattr,
|
|||
}
|
||||
|
||||
static struct module_attribute refcnt = {
|
||||
.attr = { .name = "refcnt", .mode = 0444, .owner = THIS_MODULE },
|
||||
.attr = { .name = "refcnt", .mode = 0444 },
|
||||
.show = show_refcnt,
|
||||
};
|
||||
|
||||
|
@ -851,7 +850,7 @@ static ssize_t show_initstate(struct module_attribute *mattr,
|
|||
}
|
||||
|
||||
static struct module_attribute initstate = {
|
||||
.attr = { .name = "initstate", .mode = 0444, .owner = THIS_MODULE },
|
||||
.attr = { .name = "initstate", .mode = 0444 },
|
||||
.show = show_initstate,
|
||||
};
|
||||
|
||||
|
@ -1032,7 +1031,6 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
|
|||
sattr->mattr.show = module_sect_show;
|
||||
sattr->mattr.store = NULL;
|
||||
sattr->mattr.attr.name = sattr->name;
|
||||
sattr->mattr.attr.owner = mod;
|
||||
sattr->mattr.attr.mode = S_IRUGO;
|
||||
*(gattr++) = &(sattr++)->mattr.attr;
|
||||
}
|
||||
|
@ -1090,7 +1088,6 @@ int module_add_modinfo_attrs(struct module *mod)
|
|||
if (!attr->test ||
|
||||
(attr->test && attr->test(mod))) {
|
||||
memcpy(temp_attr, attr, sizeof(*temp_attr));
|
||||
temp_attr->attr.owner = mod;
|
||||
error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr);
|
||||
++temp_attr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue