Skip to content

Commit 5373b8a

Browse files
pcctehcaster
authored andcommitted
kasan: call kasan_malloc() from __kmalloc_*track_caller()
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 <[email protected]> Cc: <[email protected]> # 5.15 Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 7e9c323 commit 5373b8a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mm/slub.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4926,6 +4926,8 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
49264926
/* Honor the call site pointer we received. */
49274927
trace_kmalloc(caller, ret, s, size, s->size, gfpflags);
49284928

4929+
ret = kasan_kmalloc(s, ret, size, gfpflags);
4930+
49294931
return ret;
49304932
}
49314933
EXPORT_SYMBOL(__kmalloc_track_caller);
@@ -4957,6 +4959,8 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
49574959
/* Honor the call site pointer we received. */
49584960
trace_kmalloc_node(caller, ret, s, size, s->size, gfpflags, node);
49594961

4962+
ret = kasan_kmalloc(s, ret, size, gfpflags);
4963+
49604964
return ret;
49614965
}
49624966
EXPORT_SYMBOL(__kmalloc_node_track_caller);

0 commit comments

Comments
 (0)