diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_kasan.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/test_kasan.c b/lib/test_kasan.c index d85f25c65b0a..b63b367a94e8 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -693,6 +693,22 @@ static noinline void __init kasan_bitops(void) kfree(bits); } +static noinline void __init kmalloc_double_kzfree(void) +{ + char *ptr; + size_t size = 16; + + pr_info("double-free (kzfree)\n"); + ptr = kmalloc(size, GFP_KERNEL); + if (!ptr) { + pr_err("Allocation failed\n"); + return; + } + + kzfree(ptr); + kzfree(ptr); +} + static int __init kmalloc_tests_init(void) { /* @@ -735,6 +751,7 @@ static int __init kmalloc_tests_init(void) kasan_memcmp(); kasan_strings(); kasan_bitops(); + kmalloc_double_kzfree(); kasan_restore_multi_shot(multishot); |