public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Prevent NULL pointer deref in grab_swap_token
@ 2006-03-07 21:13 Dean Roe
  2006-03-07 21:25 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dean Roe @ 2006-03-07 21:13 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, riel

grab_swap_token() assumes that the current process has an mm struct,
which is not true for kernel threads invoking get_user_pages().  Since
this should be extremely rare, just return from grab_swap_token()
without doing anything.

	Signed-off-by: Dean Roe <roe@sgi.com>


Index: linux-2.6/mm/thrash.c
===================================================================
--- linux-2.6.orig/mm/thrash.c
+++ linux-2.6/mm/thrash.c
@@ -54,6 +54,9 @@
 	struct mm_struct *mm;
 	int reason;
 
+	if (current->mm == NULL)
+		return;
+
 	/* We have the token. Let others know we still need it. */
 	if (has_swap_token(current->mm)) {
 		current->mm->recent_pagein = 1;

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

end of thread, other threads:[~2006-03-08  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07 21:13 [PATCH] Prevent NULL pointer deref in grab_swap_token Dean Roe
2006-03-07 21:25 ` Andrew Morton
2006-03-07 22:49 ` Christoph Hellwig
2006-03-07 23:12   ` Andrew Morton
2006-03-08  9:20 ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox