Skip to content

Commit 41ffaa0

Browse files
joshuahahnakpm00
authored andcommitted
mm/mempolicy: fix incorrect freeing of wi_kobj
We should not free wi_group->wi_kobj here. In the error path of add_weighted_interleave_group() where this snippet is called from, kobj_{del, put} is immediately called right after this section. Thus, it is not only unnecessary but also incorrect to free it here. Link: https://lkml.kernel.org/r/20250602162345.2595696-1-joshua.hahnjy@gmail.com Fixes: e341f9c ("mm/mempolicy: Weighted Interleave Auto-tuning") Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202506011545.Fduxqxqj-lkp@intel.com/ Cc: Alistair Popple <apopple@nvidia.com> Cc: Byungchul Park <byungchul@sk.com> Cc: David Hildenbrand <david@redhat.com> Cc: Gregory Price <gourry@gourry.net> Cc: "Huang, Ying" <ying.huang@linux.alibaba.com> Cc: Mathew Brost <matthew.brost@intel.com> Cc: Rakie Kim <rakie.kim@sk.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 044d2ae commit 41ffaa0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mm/mempolicy.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3708,15 +3708,13 @@ static void wi_state_free(void)
37083708
lockdep_is_held(&wi_state_lock));
37093709
if (!old_wi_state) {
37103710
mutex_unlock(&wi_state_lock);
3711-
goto out;
3711+
return;
37123712
}
37133713

37143714
rcu_assign_pointer(wi_state, NULL);
37153715
mutex_unlock(&wi_state_lock);
37163716
synchronize_rcu();
37173717
kfree(old_wi_state);
3718-
out:
3719-
kfree(&wi_group->wi_kobj);
37203718
}
37213719

37223720
static struct kobj_attribute wi_auto_attr =

0 commit comments

Comments
 (0)