From: Dean Roe <roe@sgi.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, riel@redhat.com
Subject: [PATCH] Prevent NULL pointer deref in grab_swap_token
Date: Tue, 7 Mar 2006 15:13:44 -0600 [thread overview]
Message-ID: <20060307211344.GA2946@sgi.com> (raw)
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;
next reply other threads:[~2006-03-07 21:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-07 21:13 Dean Roe [this message]
2006-03-07 21:25 ` [PATCH] Prevent NULL pointer deref in grab_swap_token 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
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=20060307211344.GA2946@sgi.com \
--to=roe@sgi.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@redhat.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