]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commit
mm/list_lru.c: avoid error-path NULL pointer deref
authorAlexander Polakov <apolyakov@beget.ru>
Fri, 28 Oct 2016 00:46:27 +0000 (17:46 -0700)
committerIshan Mittal <imittal@nvidia.com>
Fri, 6 Jan 2017 10:16:46 +0000 (15:46 +0530)
commitcb5dd648ddc707b901d0170e5958ce12c4a4edbf
tree0d0393366b52e56fde33621810360ff7804b70bc
parent1ba29dc569d656795b449aa7fcdfa1fd576c5034
mm/list_lru.c: avoid error-path NULL pointer deref

commit 1bc11d70b5db7c6bb1414b283d7f09b1fe1ac0d0 upstream.

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]
Signed-off-by: Alexander Polakov <apolyakov@beget.ru>
Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/list_lru.c