All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: numa: fix NULL pointer dereference
@ 2013-08-07  0:02 Mauro Dreissig
  2013-08-07  0:19 ` zhouxinxing
  2013-08-07  2:10 ` Mauro Dreissig
  0 siblings, 2 replies; 3+ messages in thread
From: Mauro Dreissig @ 2013-08-07  0:02 UTC (permalink / raw)
  To: linux-mm; +Cc: mukadr

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>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: numa: fix NULL pointer dereference
  2013-08-07  0:02 [PATCH] mm: numa: fix NULL pointer dereference Mauro Dreissig
@ 2013-08-07  0:19 ` zhouxinxing
  2013-08-07  2:10 ` Mauro Dreissig
  1 sibling, 0 replies; 3+ messages in thread
From: zhouxinxing @ 2013-08-07  0:19 UTC (permalink / raw)
  To: Mauro Dreissig, linux-mm

[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]

Is it possible to check pol if it is equal to NULL prior to access to mode field?

Mauro Dreissig <mukadr@gmail.com> wrote:

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

-- 
Sent from my Android device with Gmail Plus. Please excuse my brevity.

[-- Attachment #2: Type: text/html, Size: 1616 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: numa: fix NULL pointer dereference
  2013-08-07  0:02 [PATCH] mm: numa: fix NULL pointer dereference Mauro Dreissig
  2013-08-07  0:19 ` zhouxinxing
@ 2013-08-07  2:10 ` Mauro Dreissig
  1 sibling, 0 replies; 3+ messages in thread
From: Mauro Dreissig @ 2013-08-07  2:10 UTC (permalink / raw)
  To: linux-mm; +Cc: Mauro D

[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]

2013/8/6 Mauro Dreissig <mukadr@gmail.com>

> 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
>
>
A patch about this issue already exist, please ignore my message.

http://marc.info/?l=linux-mm&m=137576205227365&w=2

[-- Attachment #2: Type: text/html, Size: 2180 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-07  2:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07  0:02 [PATCH] mm: numa: fix NULL pointer dereference Mauro Dreissig
2013-08-07  0:19 ` zhouxinxing
2013-08-07  2:10 ` Mauro Dreissig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.