Commit 0cae3457 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Torvalds
Browse files

mempolicy: ERR_PTR dereference in mpol_shared_policy_init()

The original code called mpol_put(new) while "new" was an ERR_PTR.
Signed-off-by: default avatarDan Carpenter <>
Cc: Lee Schermerhorn <>
Cc: KOSAKI Motohiro <>
Cc: Christoph Lameter <>
Acked-by: default avatarDavid Rientjes <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent b1cdc467
......@@ -2098,7 +2098,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
/* contextualize the tmpfs mount point mempolicy */
new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask);
if (IS_ERR(new))
goto put_free; /* no valid nodemask intersection */
goto free_scratch; /* no valid nodemask intersection */
ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch);
......@@ -2114,6 +2114,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
mpol_put(new); /* drop initial ref */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment