From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Alexander Polakov <apolyakov@beget.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
bugzilla-daemon@bugzilla.kernel.org,
Al Viro <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org
Subject: Re: [Bug 177821] New: NULL pointer dereference in list_rcu
Date: Tue, 18 Oct 2016 19:41:31 +0300 [thread overview]
Message-ID: <20161018164131.GB14704@esperanza> (raw)
In-Reply-To: <FA3391F9-B333-451D-8415-CB5B62030A9D@beget.ru>
On Tue, Oct 18, 2016 at 10:26:55AM +0300, Alexander Polakov wrote:
> From: Alexander Polakov <apolyakov@beget.ru>
> Subject: mm/list_lru.c: avoid error-path NULL pointer deref
>
> As described in https://bugzilla.kernel.org/show_bug.cgi?id=177821:
>
> After some analysis it seems to be that the problem is in alloc_super().
> In case list_lru_init_memcg() fails it goes into destroy_super(), which
> calls list_lru_destroy().
>
> And in list_lru_init() we see that in case memcg_init_list_lru() fails,
> lru->node is freed, but not set NULL, which then leads list_lru_destroy()
> to believe it is initialized and call memcg_destroy_list_lru().
> memcg_destroy_list_lru() in turn can access lru->node[i].memcg_lrus, which
> is NULL.
>
> [akpm@linux-foundation.org: add comment]
> Cc: Vladimir Davydov <vdavydov@parallels.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Alexander Polakov <apolyakov@beget.ru>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
FWIW,
The patch is indeed correct. However, failing a mount because of
inability to allocate per memcg data sounds bad. We should probably
fallback on vmalloc in memcg_{init,update}_list_lru_node() or use a
contrived data structure, like flex_array, there. This is also fair for
{init,update}_memcg_params in mm/slab_common.c.
Thanks,
Vladimir
--
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:[~2016-10-18 16:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-177821-27@https.bugzilla.kernel.org/>
2016-10-17 23:56 ` [Bug 177821] New: NULL pointer dereference in list_rcu Andrew Morton
2016-10-18 0:10 ` Andrew Morton
2016-10-18 7:26 ` Alexander Polakov
2016-10-18 16:41 ` Vladimir Davydov [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=20161018164131.GB14704@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apolyakov@beget.ru \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).