Message ID | 20220329111416.27954-1-linmiaohe@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v4] mm/mempolicy: fix mpol_new leak in shared_policy_replace | expand |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index a2516d31db6c..6b34c5d5e65a 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2733,6 +2733,7 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL); if (!mpol_new) goto err_out; + atomic_set(&mpol_new->refcnt, 1); goto restart; }