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+0xaf1/0xbd0 crypto/chacha20_generic.c:91 Read of size 4 at addr ffff8801bfb41b00 by task kworker/1:3/7618 CPU: 1 PID: 7618 Comm: kworker/1:3 Not tainted 4.15.0-rc3+ #156 Subscription rejected, illegal request 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+0xaf1/0xbd0 crypto/chacha20_generic.c:91 Subscription rejected, illegal request chacha20_simd+0xe4/0x410 arch/x86/crypto/chacha20_glue.c:78 crypto_skcipher_decrypt include/crypto/skcipher.h:463 [inline] cryptd_skcipher_decrypt+0x2de/0x5a0 crypto/cryptd.c:523 cryptd_queue_worker+0xff/0x1b0 crypto/cryptd.c:190 process_one_work+0xbf3/0x1bc0 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:441 Allocated by task 4299: 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 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3610 kmalloc include/linux/slab.h:499 [inline] kzalloc include/linux/slab.h:688 [inline] xfrm_state_alloc+0xb8/0x630 net/xfrm/xfrm_state.c:565 xfrm_state_find+0x1ace/0x3210 net/xfrm/xfrm_state.c:1002 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:1388 [inline] xfrm_tmpl_resolve+0x309/0xc00 net/xfrm/xfrm_policy.c:1432 xfrm_resolve_and_create_bundle+0x12c/0x2770 net/xfrm/xfrm_policy.c:1823 xfrm_bundle_lookup net/xfrm/xfrm_policy.c:2060 [inline] xfrm_lookup+0x965/0x23e0 net/xfrm/xfrm_policy.c:2176 xfrm_lookup_route+0x39/0x1a0 net/xfrm/xfrm_policy.c:2266 ip6_dst_lookup_flow+0x1c2/0x270 net/ipv6/ip6_output.c:1082 ip6_datagram_dst_update+0x720/0x13d0 net/ipv6/datagram.c:91 ip6_datagram_release_cb+0x3cb/0x520 net/ipv6/datagram.c:139 release_sock+0x105/0x2a0 net/core/sock.c:2785 udpv6_destroy_sock+0x7a/0x190 net/ipv6/udp.c:1401 sk_common_release+0x6b/0x2f0 net/core/sock.c:2989 udp_lib_close+0x15/0x20 include/net/udp.h:203 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:426 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:433 sock_release+0x8d/0x1e0 net/socket.c:600 sock_close+0x16/0x20 net/socket.c:1129 __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 get_signal+0x73f/0x16c0 kernel/signal.c:2335 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0x214/0x310 arch/x86/entry/common.c:158 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264 entry_SYSCALL_64_fastpath+0x94/0x96 Freed by task 7618: 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+0xca/0x250 mm/slab.c:3803 xfrm_state_gc_destroy net/xfrm/xfrm_state.c:453 [inline] xfrm_state_gc_task+0x53e/0x6c0 net/xfrm/xfrm_state.c:469 process_one_work+0xbf3/0x1bc0 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:441 The buggy address belongs to the object at ffff8801bfb41b00 which belongs to the cache kmalloc-1024 of size 1024 The buggy address is located 0 bytes inside of 1024-byte region [ffff8801bfb41b00, ffff8801bfb41f00) The buggy address belongs to the page: page:00000000e17fc527 count:1 mapcount:0 mapping:00000000d22ba31d index:0xffff8801bfb41200 compound_mapcount: 0 flags: 0x2fffc0000008100(slab|head) raw: 02fffc0000008100 ffff8801bfb40000 ffff8801bfb41200 0000000100000006 raw: ffffea000725a1a0 ffffea0007342320 ffff8801db000ac0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801bfb41a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801bfb41a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801bfb41b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801bfb41b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801bfb41c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================