diff options
-rw-r--r-- | fs/kernfs/dir.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index e1681775abd5..d33af95321fb 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -886,7 +886,11 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, if (!new_name) goto out; - kfree(kn->name); + if (kn->flags & KERNFS_STATIC_NAME) + kn->flags &= ~KERNFS_STATIC_NAME; + else + kfree(kn->name); + kn->name = new_name; } |