]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/rmap.c
drm/i915: Convert BUGs to WARNs in the video overlay code
[karo-tx-linux.git] / mm / rmap.c
index 5e3e09081164b83814683513c174445e67669a4b..c161a14b6a8fb127150678f18582ad6f0a29f55d 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -287,6 +287,13 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
        return 0;
 
  enomem_failure:
+       /*
+        * dst->anon_vma is dropped here otherwise its degree can be incorrectly
+        * decremented in unlink_anon_vmas().
+        * We can safely do this because callers of anon_vma_clone() don't care
+        * about dst->anon_vma if anon_vma_clone() failed.
+        */
+       dst->anon_vma = NULL;
        unlink_anon_vmas(dst);
        return -ENOMEM;
 }