Use struct sctp_assoc_value instead ================================================================== BUG: KASAN: use-after-free in __le32_to_cpup include/uapi/linux/byteorder/little_endian.h:58 [inline] BUG: KASAN: use-after-free in le32_to_cpuvp crypto/chacha20_generic.c:19 [inline] BUG: KASAN: use-after-free in crypto_chacha20_init crypto/chacha20_generic.c:58 [inline] BUG: KASAN: use-after-free in crypto_chacha20_crypt+0xb1a/0xc00 crypto/chacha20_generic.c:91 Read of size 4 at addr ffff8801c31114c0 by task kworker/1:5/19642 CPU: 1 PID: 19642 Comm: kworker/1:5 Not tainted 4.15.0-rc4+ #164 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: crypto cryptd_queue_worker Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429 __le32_to_cpup include/uapi/linux/byteorder/little_endian.h:58 [inline] le32_to_cpuvp crypto/chacha20_generic.c:19 [inline] crypto_chacha20_init crypto/chacha20_generic.c:58 [inline] crypto_chacha20_crypt+0xb1a/0xc00 crypto/chacha20_generic.c:91 chacha20_simd+0xe4/0x410 arch/x86/crypto/chacha20_glue.c:78 crypto_skcipher_decrypt include/crypto/skcipher.h:463 [inline] cryptd_skcipher_decrypt+0x2ed/0x5c0 crypto/cryptd.c:523 cryptd_queue_worker+0xff/0x1b0 crypto/cryptd.c:190 process_one_work+0xbbf/0x1b10 kernel/workqueue.c:2112 worker_thread+0x223/0x1990 kernel/workqueue.c:2246 kthread+0x33c/0x400 kernel/kthread.c:238 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:515 Allocated by task 904: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 __do_kmalloc mm/slab.c:3708 [inline] __kmalloc+0x162/0x760 mm/slab.c:3717 kmalloc include/linux/slab.h:504 [inline] sock_kmalloc+0x112/0x190 net/core/sock.c:1989 skcipher_accept_parent_nokey+0xde/0x4b0 crypto/algif_skcipher.c:375 skcipher_accept_parent+0x95/0xd0 crypto/algif_skcipher.c:407 af_alg_accept+0x125/0x670 crypto/af_alg.c:294 alg_accept+0x46/0x60 crypto/af_alg.c:330 SYSC_accept4+0x38d/0x870 net/socket.c:1543 SyS_accept4 net/socket.c:1494 [inline] SYSC_accept net/socket.c:1577 [inline] SyS_accept+0x26/0x30 net/socket.c:1574 entry_SYSCALL_64_fastpath+0x1f/0x96 Freed by task 900: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3488 [inline] kfree+0xd6/0x260 mm/slab.c:3803 kzfree+0x28/0x30 mm/slab_common.c:1482 __sock_kfree_s net/core/sock.c:2008 [inline] sock_kzfree_s+0x29/0x60 net/core/sock.c:2022 skcipher_sock_destruct+0x132/0x1e0 crypto/algif_skcipher.c:358 __sk_destruct+0xfd/0x910 net/core/sock.c:1563 sk_destruct+0x47/0x80 net/core/sock.c:1598 __sk_free+0xf1/0x2b0 net/core/sock.c:1609 sk_free+0x2a/0x40 net/core/sock.c:1620 sock_put include/net/sock.h:1652 [inline] af_alg_release+0x5d/0x70 crypto/af_alg.c:126 sock_release+0x8d/0x1e0 net/socket.c:593 sock_close+0x16/0x20 net/socket.c:1121 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x9bb/0x1ad0 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:968 SYSC_exit_group kernel/exit.c:979 [inline] SyS_exit_group+0x1d/0x20 kernel/exit.c:977 entry_SYSCALL_64_fastpath+0x1f/0x96 The buggy address belongs to the object at ffff8801c31114c0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff8801c31114c0, ffff8801c31114e0) The buggy address belongs to the page: page:0000000021e49c2b count:1 mapcount:0 mapping:000000003955e7f6 index:0xffff8801c3111fc1 flags: 0x2fffc0000000100(slab) raw: 02fffc0000000100 ffff8801c3111000 ffff8801c3111fc1 000000010000003b raw: ffffea0007322ea0 ffffea0007297960 ffff8801db0001c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c3111380: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff8801c3111400: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc >ffff8801c3111480: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ^ ffff8801c3111500: 00 00 fc fc fc fc fc fc 03 fc fc fc fc fc fc fc ffff8801c3111580: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================