--- a/mm/slub.c +++ b/mm/slub.c @@ -5424,8 +5424,10 @@ static int sysfs_slab_add(struct kmem_ca s->kobj.kset = cache_kset(s); err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name); - if (err) + if (err) { + kobject_put(&s->kobj); goto out; + } err = sysfs_create_group(&s->kobj, &slab_attr_group); if (err)