linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Dreissig <mukadr@gmail.com>
To: linux-mm@kvack.org
Cc: mukadr@gmail.com
Subject: [PATCH] mm: numa: fix NULL pointer dereference
Date: Tue, 6 Aug 2013 21:02:23 -0300	[thread overview]
Message-ID: <20130807000154.GA3507@z460> (raw)

From: Mauro Dreissig <mukadr@gmail.com>

The "pol->mode" field is accessed even when no mempolicy
is assigned to the "pol" variable.

Signed-off-by: Mauro Dreissig <mukadr@gmail.com>
---
 mm/mempolicy.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 6b1d426..105fff0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -127,12 +127,16 @@ static struct mempolicy *get_task_policy(struct task_struct *p)
 
 	if (!pol) {
 		node = numa_node_id();
-		if (node != NUMA_NO_NODE)
+		if (node != NUMA_NO_NODE) {
 			pol = &preferred_node_policy[node];
 
-		/* preferred_node_policy is not initialised early in boot */
-		if (!pol->mode)
-			pol = NULL;
+			/*
+			 * preferred_node_policy is not initialised early
+			 * in boot
+			 */
+			if (!pol->mode)
+				pol = NULL;
+		}
 	}
 
 	return pol;
-- 
1.8.1.2

--
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>

             reply	other threads:[~2013-08-07  0:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07  0:02 Mauro Dreissig [this message]
2013-08-07  0:19 ` zhouxinxing
2013-08-07  2:10 ` Mauro Dreissig

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=20130807000154.GA3507@z460 \
    --to=mukadr@gmail.com \
    --cc=linux-mm@kvack.org \
    /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