diff options
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index a63d12e4be56..a26e3db89432 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -497,6 +497,9 @@ int sysfs_rename_dir(struct kobject * kobj, struct dentry *new_parent, | |||
497 | d_move(kobj->dentry, new_dentry); | 497 | d_move(kobj->dentry, new_dentry); |
498 | 498 | ||
499 | list_del_init(&sd->s_sibling); | 499 | list_del_init(&sd->s_sibling); |
500 | sysfs_get(parent_sd); | ||
501 | sysfs_put(sd->s_parent); | ||
502 | sd->s_parent = parent_sd; | ||
500 | list_add(&sd->s_sibling, &parent_sd->s_children); | 503 | list_add(&sd->s_sibling, &parent_sd->s_children); |
501 | 504 | ||
502 | error = 0; | 505 | error = 0; |
@@ -550,6 +553,9 @@ again: | |||
550 | 553 | ||
551 | /* Remove from old parent's list and insert into new parent's list. */ | 554 | /* Remove from old parent's list and insert into new parent's list. */ |
552 | list_del_init(&sd->s_sibling); | 555 | list_del_init(&sd->s_sibling); |
556 | sysfs_get(new_parent_sd); | ||
557 | sysfs_put(sd->s_parent); | ||
558 | sd->s_parent = new_parent_sd; | ||
553 | list_add(&sd->s_sibling, &new_parent_sd->s_children); | 559 | list_add(&sd->s_sibling, &new_parent_sd->s_children); |
554 | 560 | ||
555 | out: | 561 | out: |