lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 7 May 2014 02:58:46 +0000
From:	"Ma, Xindong" <xindong.ma@...el.com>
To:	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"iamjoonsoo.kim@....com" <iamjoonsoo.kim@....com>,
	"n-horiguchi@...jp.nec.com" <n-horiguchi@...jp.nec.com>,
	"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
	"gorcunov@...il.com" <gorcunov@...il.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] rmap: validate pointer in anon_vma_clone

Sorry, my fault. It's already validated in unlock_anon_vma_root().


BR
Leon


-----Original Message-----
From: Ma, Xindong 
Sent: Wednesday, May 07, 2014 10:32 AM
To: akpm@...ux-foundation.org; iamjoonsoo.kim@....com; n-horiguchi@...jp.nec.com; kirill.shutemov@...ux.intel.com; gorcunov@...il.com; linux-mm@...ck.org; linux-kernel@...r.kernel.org
Cc: Ma, Xindong
Subject: [PATCH] rmap: validate pointer in anon_vma_clone

If memory allocation failed in first loop, root will be NULL and will lead to kernel panic.

Signed-off-by: Leon Ma <xindong.ma@...el.com>
---
 mm/rmap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 9c3e773..6e53aed 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -246,8 +246,10 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
 
 		avc = anon_vma_chain_alloc(GFP_NOWAIT | __GFP_NOWARN);
 		if (unlikely(!avc)) {
-			unlock_anon_vma_root(root);
-			root = NULL;
+			if (!root) {
+				unlock_anon_vma_root(root);
+				root = NULL;
+			}
 			avc = anon_vma_chain_alloc(GFP_KERNEL);
 			if (!avc)
 				goto enomem_failure;
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ