From: Johannes Weiner <hannes@cmpxchg.org>
To: Bob Liu <lliubbo@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, mpm@selenic.com
Subject: Re: [PATCH] slob: Get lock before getting slob_list
Date: Mon, 5 Jul 2010 16:28:11 +0200 [thread overview]
Message-ID: <20100705142811.GB1493@cmpxchg.org> (raw)
In-Reply-To: <1278334297-6952-1-git-send-email-lliubbo@gmail.com>
On Mon, Jul 05, 2010 at 08:51:37PM +0800, Bob Liu wrote:
> If get lock after getting slob_list, the partially free page list maybe
> changed before list_for_each_entry().
Nodes of the lists may, but not the addresses of the static list
heads! The locking is fine as it is.
> And maybe trigger a NULL pointer access Bug like this:
[snip]
There is something else going on. It might be a good idea to see if
this bug is reproducible on an upstream kernel and not some random svn
checkout from who knows where.
> diff --git a/mm/slob.c b/mm/slob.c
> index 3f19a34..c391f55 100644
> --- a/mm/slob.c
> +++ b/mm/slob.c
> @@ -326,6 +326,8 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
> slob_t *b = NULL;
> unsigned long flags;
>
> + spin_lock_irqsave(&slob_lock, flags);
> +
> if (size < SLOB_BREAK1)
> slob_list = &free_slob_small;
> else if (size < SLOB_BREAK2)
> @@ -333,7 +335,6 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
> else
> slob_list = &free_slob_large;
>
> - spin_lock_irqsave(&slob_lock, flags);
> /* Iterate through each partially free page, try to find room */
> list_for_each_entry(sp, slob_list, list) {
--
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>
prev parent reply other threads:[~2010-07-05 14:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-05 12:51 Bob Liu
2010-07-05 14:28 ` Johannes Weiner [this message]
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=20100705142811.GB1493@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lliubbo@gmail.com \
--cc=mpm@selenic.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