diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 26909396898b6..afe803dbcab1b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2984,8 +2984,10 @@ static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent, return -ENOMEM; retval = sysfs_create_group(hstate_kobjs[hi], hstate_attr_group); - if (retval) + if (retval) { kobject_put(hstate_kobjs[hi]); + hstate_kobjs[hi] = NULL; + } return retval; }