From: "Ma, Xindong" <xindong.ma@intel.com>
To: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"iamjoonsoo.kim@lge.com" <iamjoonsoo.kim@lge.com>,
"n-horiguchi@ah.jp.nec.com" <n-horiguchi@ah.jp.nec.com>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"gorcunov@gmail.com" <gorcunov@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] rmap: validate pointer in anon_vma_clone
Date: Wed, 7 May 2014 02:58:46 +0000 [thread overview]
Message-ID: <3917C05D9F83184EAA45CE249FF1B1DD025C8840@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1399429930-5073-1-git-send-email-xindong.ma@intel.com>
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@linux-foundation.org; iamjoonsoo.kim@lge.com; n-horiguchi@ah.jp.nec.com; kirill.shutemov@linux.intel.com; gorcunov@gmail.com; linux-mm@kvack.org; linux-kernel@vger.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@intel.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-05-07 2:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 2:32 Leon Ma
2014-05-07 2:58 ` Ma, Xindong [this message]
2014-05-07 4:28 ` Jianyu Zhan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3917C05D9F83184EAA45CE249FF1B1DD025C8840@SHSMSX103.ccr.corp.intel.com \
--to=xindong.ma@intel.com \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@gmail.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=n-horiguchi@ah.jp.nec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox