Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 867dc3a6 authored by Daniel Forrest's avatar Daniel Forrest Committed by Greg Kroah-Hartman
Browse files

mm: fix anon_vma_clone() error treatment

commit c4ea95d7 upstream.

Andrew Morton noticed that the error return from anon_vma_clone() was
being dropped and replaced with -ENOMEM (which is not itself a bug
because the only error return value from anon_vma_clone() is -ENOMEM).

I did an audit of callers of anon_vma_clone() and discovered an actual
bug where the error return was being lost.  In __split_vma(), between
Linux 3.11 and 3.12 the code was changed so the err variable is used
before the call to anon_vma_clone() and the default initial value of
-ENOMEM is overwritten.  So a failure of anon_vma_clone() will return
success since err at this point is now zero.

Below is a patch which fixes this bug and also propagates the error
return value from anon_vma_clone() in all cases.

Fixes: ef0855d3

 ("mm: mempolicy: turn vma_set_policy() into vma_dup_policy()")
Signed-off-by: default avatarDaniel Forrest <dan.forrest@ssec.wisc.edu>
Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: Konstantin...
parent f7c6aba5
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