[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250602162345.2595696-1-joshua.hahnjy@gmail.com>
Date: Mon, 2 Jun 2025 09:23:39 -0700
From: Joshua Hahn <joshua.hahnjy@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Gregory Price <gourry@...rry.net>
Cc: David Hildenbrand <david@...hat.com>,
Zi Yan <ziy@...dia.com>,
Matthew Brost <matthew.brost@...el.com>,
Rakie Kim <rakie.kim@...com>,
Byungchul Park <byungchul@...com>,
Ying Huang <ying.huang@...ux.alibaba.com>,
Alistair Popple <apopple@...dia.com>,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
kernel-team@...a.com,
kernel test robot <lkp@...el.com>
Subject: [PATCH 1/2] 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.
Signed-off-by: Joshua Hahn <joshua.hahnjy@...il.com>
Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506011545.Fduxqxqj-lkp@intel.com/
---
mm/mempolicy.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 72fd72e156b1..3b1dfd08338b 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -3708,15 +3708,13 @@ static void wi_state_free(void)
lockdep_is_held(&wi_state_lock));
if (!old_wi_state) {
mutex_unlock(&wi_state_lock);
- goto out;
+ return;
}
rcu_assign_pointer(wi_state, NULL);
mutex_unlock(&wi_state_lock);
synchronize_rcu();
kfree(old_wi_state);
-out:
- kfree(&wi_group->wi_kobj);
}
static struct kobj_attribute wi_auto_attr =
--
2.47.1
Powered by blists - more mailing lists