]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Jun 2014 22:11:05 +0000 (15:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Jun 2014 22:11:05 +0000 (15:11 -0700)
added patches:
mm-rmap-fix-use-after-free-in-__put_anon_vma.patch

queue-3.4/mm-rmap-fix-use-after-free-in-__put_anon_vma.patch [new file with mode: 0644]
queue-3.4/series

diff --git a/queue-3.4/mm-rmap-fix-use-after-free-in-__put_anon_vma.patch b/queue-3.4/mm-rmap-fix-use-after-free-in-__put_anon_vma.patch
new file mode 100644 (file)
index 0000000..f9f20f2
--- /dev/null
@@ -0,0 +1,42 @@
+From 624483f3ea82598ab0f62f1bdb9177f531ab1892 Mon Sep 17 00:00:00 2001
+From: Andrey Ryabinin <a.ryabinin@samsung.com>
+Date: Fri, 6 Jun 2014 19:09:30 +0400
+Subject: mm: rmap: fix use-after-free in __put_anon_vma
+
+From: Andrey Ryabinin <a.ryabinin@samsung.com>
+
+commit 624483f3ea82598ab0f62f1bdb9177f531ab1892 upstream.
+
+While working address sanitizer for kernel I've discovered
+use-after-free bug in __put_anon_vma.
+
+For the last anon_vma, anon_vma->root freed before child anon_vma.
+Later in anon_vma_free(anon_vma) we are referencing to already freed
+anon_vma->root to check rwsem.
+
+This fixes it by freeing the child anon_vma before freeing
+anon_vma->root.
+
+Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
+Acked-by: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/rmap.c |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/mm/rmap.c
++++ b/mm/rmap.c
+@@ -1721,10 +1721,9 @@ void __put_anon_vma(struct anon_vma *ano
+ {
+       struct anon_vma *root = anon_vma->root;
++      anon_vma_free(anon_vma);
+       if (root != anon_vma && atomic_dec_and_test(&root->refcount))
+               anon_vma_free(root);
+-
+-      anon_vma_free(anon_vma);
+ }
+ #ifdef CONFIG_MIGRATION
index b4adbdcf3c09b400248ab541f33a266f3a8ce2fe..4e25d3157fcb74b4adba7baa10c90af1b56727ca 100644 (file)
@@ -14,3 +14,4 @@ usb-ftdi_sio-add-novatech-orionlxm-product-id.patch
 usb-serial-option-add-support-for-novatel-e371-pcie-card.patch
 usb-io_ti-fix-firmware-download-on-big-endian-machines-part-2.patch
 usb-avoid-runtime-suspend-loops-for-hcds-that-can-t-handle-suspend-resume.patch
+mm-rmap-fix-use-after-free-in-__put_anon_vma.patch