From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx115.postini.com [74.125.245.115]) by kanga.kvack.org (Postfix) with SMTP id A24076B003D for ; Tue, 6 Aug 2013 22:10:25 -0400 (EDT) Received: by mail-qe0-f43.google.com with SMTP id k5so689972qej.30 for ; Tue, 06 Aug 2013 19:10:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20130807000154.GA3507@z460> References: <20130807000154.GA3507@z460> Date: Tue, 6 Aug 2013 23:10:24 -0300 Message-ID: Subject: Re: [PATCH] mm: numa: fix NULL pointer dereference From: Mauro Dreissig Content-Type: multipart/alternative; boundary=047d7b6da3d26082a804e3520b33 Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: Mauro D --047d7b6da3d26082a804e3520b33 Content-Type: text/plain; charset=ISO-8859-1 2013/8/6 Mauro Dreissig > From: Mauro Dreissig > > The "pol->mode" field is accessed even when no mempolicy > is assigned to the "pol" variable. > > Signed-off-by: Mauro Dreissig > --- > 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 > > A patch about this issue already exist, please ignore my message. http://marc.info/?l=linux-mm&m=137576205227365&w=2 --047d7b6da3d26082a804e3520b33 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
2013/8/6 Mauro Dreissig <mukadr@gmail.com>
From: Mauro Dreissig <mukadr@gmail.c= om>

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

Signed-off-by: Mauro Dreissig <mukad= r@gmail.com>
---
=A0mm/mempolicy.c | 12 ++++++++----
=A01 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)

=A0 =A0 =A0 =A0 if (!pol) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 node =3D numa_node_id();
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (node !=3D NUMA_NO_NODE)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (node !=3D NUMA_NO_NODE) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pol =3D &preferred_node= _policy[node];

- =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* preferred_node_policy is not initialised e= arly in boot */
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!pol->mode)
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pol =3D NULL;
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* preferred_node_policy is= not initialised early
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* in boot
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!pol->mode)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pol =3D NULL;=
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
=A0 =A0 =A0 =A0 }

=A0 =A0 =A0 =A0 return pol;
--
1.8.1.2


A patch about this iss= ue already exist, please ignore my message.

--047d7b6da3d26082a804e3520b33-- -- 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: email@kvack.org