diff options
author | Peter Collingbourne <pcc@google.com> | 2022-09-13 19:00:01 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-09-28 11:11:44 +0200 |
commit | bf0197aea19562be03a5c179afd51adbb2a5bf80 (patch) | |
tree | b4793a5e2016576c7cfb30f2ddcd2ccdf32b7646 /mm | |
parent | c75288a4902b9ecd68c0f38bf792ce7ca2ece968 (diff) | |
download | linux-stable-bf0197aea19562be03a5c179afd51adbb2a5bf80.tar.gz linux-stable-bf0197aea19562be03a5c179afd51adbb2a5bf80.tar.bz2 linux-stable-bf0197aea19562be03a5c179afd51adbb2a5bf80.zip |
kasan: call kasan_malloc() from __kmalloc_*track_caller()
commit 5373b8a09d6e037ee0587cb5d9fe4cc09077deeb upstream.
We were failing to call kasan_malloc() from __kmalloc_*track_caller()
which was causing us to sometimes fail to produce KASAN error reports
for allocations made using e.g. devm_kcalloc(), as the KASAN poison was
not being initialized. Fix it.
Signed-off-by: Peter Collingbourne <pcc@google.com>
Cc: <stable@vger.kernel.org> # 5.15
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slub.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c index 519bbbad7b2f..6ebaff496755 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4920,6 +4920,8 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller) /* Honor the call site pointer we received. */ trace_kmalloc(caller, ret, size, s->size, gfpflags); + ret = kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_track_caller); @@ -4951,6 +4953,8 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, /* Honor the call site pointer we received. */ trace_kmalloc_node(caller, ret, size, s->size, gfpflags, node); + ret = kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_node_track_caller); |