if (kernfs_type(kn) == KERNFS_LINK)
kernfs_put(kn->symlink.target_kn);
if (!(kn->flags & KERNFS_STATIC_NAME))
- kfree(kn->name);
+ kfree_const(kn->name);
if (kn->iattr) {
if (kn->iattr->ia_secdata)
security_release_secctx(kn->iattr->ia_secdata,
const char *name, umode_t mode,
unsigned flags)
{
- char *dup_name = NULL;
+ const char *dup_name = NULL;
struct kernfs_node *kn;
int ret;
if (!(flags & KERNFS_STATIC_NAME)) {
- name = dup_name = kstrdup(name, GFP_KERNEL);
+ name = dup_name = kstrdup_const(name, GFP_KERNEL);
if (!name)
return NULL;
}
err_out2:
kmem_cache_free(kernfs_node_cache, kn);
err_out1:
- kfree(dup_name);
+ kfree_const(dup_name);
return NULL;
}
/* rename kernfs_node */
if (strcmp(kn->name, new_name) != 0) {
error = -ENOMEM;
- new_name = kstrdup(new_name, GFP_KERNEL);
+ new_name = kstrdup_const(new_name, GFP_KERNEL);
if (!new_name)
goto out;
} else {
kernfs_link_sibling(kn);
kernfs_put(old_parent);
- kfree(old_name);
+ kfree_const(old_name);
error = 0;
out: