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/[email protected] Fixes: e341f9c ("mm/mempolicy: Weighted Interleave Auto-tuning") Signed-off-by: Joshua Hahn <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Cc: Alistair Popple <[email protected]> Cc: Byungchul Park <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Gregory Price <[email protected]> Cc: "Huang, Ying" <[email protected]> Cc: Mathew Brost <[email protected]> Cc: Rakie Kim <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
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)