diff options
-rw-r--r-- | fs/sysfs/file.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index ff93c92164b3..9fdf8dae0dcd 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -521,10 +521,19 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
521 | } | 521 | } |
522 | 522 | ||
523 | inode = victim->d_inode; | 523 | inode = victim->d_inode; |
524 | |||
524 | mutex_lock(&inode->i_mutex); | 525 | mutex_lock(&inode->i_mutex); |
526 | |||
525 | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); | 527 | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); |
526 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 528 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
527 | rc = notify_change(victim, &newattrs); | 529 | rc = notify_change(victim, &newattrs); |
530 | |||
531 | if (rc == 0) { | ||
532 | mutex_lock(&sysfs_mutex); | ||
533 | victim_sd->s_mode = newattrs.ia_mode; | ||
534 | mutex_unlock(&sysfs_mutex); | ||
535 | } | ||
536 | |||
528 | mutex_unlock(&inode->i_mutex); | 537 | mutex_unlock(&inode->i_mutex); |
529 | out: | 538 | out: |
530 | dput(victim); | 539 | dput(victim); |