Alexander Potapenko 73e82ee9f0 lib/stackdepot.c: fix global out-of-bounds in stack_slabs
[ Upstream commit 305e519ce48e935702c32241f07d393c3c8fed3e ]

Walter Wu has reported a potential case in which init_stack_slab() is
called after stack_slabs[STACK_ALLOC_MAX_SLABS - 1] has already been
initialized.  In that case init_stack_slab() will overwrite
stack_slabs[STACK_ALLOC_MAX_SLABS], which may result in a memory
corruption.

Link: http://lkml.kernel.org/r/20200218102950.260263-1-glider@google.com
Fixes: cd11016e5f521 ("mm, kasan: stackdepot implementation. Enable stackdepot for SLAB")
Signed-off-by: Alexander Potapenko <glider@google.com>
Reported-by: Walter Wu <walter-zh.wu@mediatek.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-28 15:42:50 +01:00
..
2014-10-09 11:35:48 +03:00
2017-09-02 07:07:54 +02:00
2019-07-10 09:55:46 +02:00
2019-12-21 10:42:00 +01:00
2015-11-23 09:44:58 +01:00
2016-03-17 15:09:34 -07:00
2019-04-20 09:07:54 +02:00
2014-04-30 19:49:37 +01:00
2019-12-05 15:35:05 +01:00
2014-08-06 18:01:25 -07:00
2017-04-21 09:31:21 +02:00
2016-05-23 17:04:14 -07:00
2016-03-09 15:43:42 -08:00
2015-02-12 18:54:15 -08:00
2014-06-25 17:45:43 -07:00
2016-04-23 20:13:24 -04:00
2015-09-08 14:35:59 -07:00
2015-02-12 18:54:16 -08:00
2016-07-06 10:51:14 +01:00
2018-10-18 09:13:24 +02:00
2016-09-19 08:19:40 -06:00
2015-03-23 22:12:08 -04:00
2015-06-25 17:00:40 -07:00
2018-12-13 09:20:29 +01:00
2016-05-30 15:26:57 -07:00