forked from Minki/linux
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: class: Free the class private data in class_release sysfs: sysfs_sd_setattr set iattrs unconditionally
This commit is contained in:
commit
1ed10aa8e9
@ -59,6 +59,8 @@ static void class_release(struct kobject *kobj)
|
||||
else
|
||||
pr_debug("class '%s' does not have a release() function, "
|
||||
"be careful\n", class->name);
|
||||
|
||||
kfree(cp);
|
||||
}
|
||||
|
||||
static struct sysfs_ops class_sysfs_ops = {
|
||||
|
@ -81,24 +81,23 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)
|
||||
if (!sd_attrs)
|
||||
return -ENOMEM;
|
||||
sd->s_iattr = sd_attrs;
|
||||
} else {
|
||||
/* attributes were changed at least once in past */
|
||||
iattrs = &sd_attrs->ia_iattr;
|
||||
}
|
||||
/* attributes were changed at least once in past */
|
||||
iattrs = &sd_attrs->ia_iattr;
|
||||
|
||||
if (ia_valid & ATTR_UID)
|
||||
iattrs->ia_uid = iattr->ia_uid;
|
||||
if (ia_valid & ATTR_GID)
|
||||
iattrs->ia_gid = iattr->ia_gid;
|
||||
if (ia_valid & ATTR_ATIME)
|
||||
iattrs->ia_atime = iattr->ia_atime;
|
||||
if (ia_valid & ATTR_MTIME)
|
||||
iattrs->ia_mtime = iattr->ia_mtime;
|
||||
if (ia_valid & ATTR_CTIME)
|
||||
iattrs->ia_ctime = iattr->ia_ctime;
|
||||
if (ia_valid & ATTR_MODE) {
|
||||
umode_t mode = iattr->ia_mode;
|
||||
iattrs->ia_mode = sd->s_mode = mode;
|
||||
}
|
||||
if (ia_valid & ATTR_UID)
|
||||
iattrs->ia_uid = iattr->ia_uid;
|
||||
if (ia_valid & ATTR_GID)
|
||||
iattrs->ia_gid = iattr->ia_gid;
|
||||
if (ia_valid & ATTR_ATIME)
|
||||
iattrs->ia_atime = iattr->ia_atime;
|
||||
if (ia_valid & ATTR_MTIME)
|
||||
iattrs->ia_mtime = iattr->ia_mtime;
|
||||
if (ia_valid & ATTR_CTIME)
|
||||
iattrs->ia_ctime = iattr->ia_ctime;
|
||||
if (ia_valid & ATTR_MODE) {
|
||||
umode_t mode = iattr->ia_mode;
|
||||
iattrs->ia_mode = sd->s_mode = mode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user