KASAN: use-after-free Read in ncm_wrap_ntb

Status: premoderation: reported on 2026/08/17 08:30
Reported-by: syzbot+7119dccc890047570f07@syzkaller.appspotmail.com
First crash: 10d, last: 10d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ncm_wrap_ntb+0xcfa/0xe40 drivers/usb/gadget/function/f_ncm.c:1057
Read of size 4 at addr ffff88811e5422f0 by task kworker/1:0/20

CPU: 1 PID: 20 Comm: kworker/1:0 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Workqueue: ipv6_addrconf addrconf_dad_work
Call Trace:
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x100/0x140 mm/kasan/report.c:452
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 ncm_wrap_ntb+0xcfa/0xe40 drivers/usb/gadget/function/f_ncm.c:1057
 eth_start_xmit+0x48d/0xd40 drivers/usb/gadget/function/u_ether.c:552
 __netdev_start_xmit include/linux/netdevice.h:4864 [inline]
 netdev_start_xmit include/linux/netdevice.h:4878 [inline]
 xmit_one net/core/dev.c:3606 [inline]
 dev_hard_start_xmit+0x245/0x680 net/core/dev.c:3622
 sch_direct_xmit+0x26d/0x990 net/sched/sch_generic.c:339
 qdisc_restart net/sched/sch_generic.c:404 [inline]
 __qdisc_run+0xa3a/0x1400 net/sched/sch_generic.c:412
 qdisc_run+0x100/0x2f0 include/net/pkt_sched.h:126
 __dev_xmit_skb net/core/dev.c:3817 [inline]
 __dev_queue_xmit+0xbc6/0x2500 net/core/dev.c:4173
 dev_queue_xmit+0x17/0x20 net/core/dev.c:4254
 neigh_hh_output include/net/neighbour.h:501 [inline]
 neigh_output include/net/neighbour.h:515 [inline]
 ip6_finish_output2+0xea9/0x1540 net/ipv6/ip6_output.c:130
 __ip6_finish_output+0x5fd/0x790 net/ipv6/ip6_output.c:201
 ip6_finish_output+0x33/0x1e0 net/ipv6/ip6_output.c:211
 NF_HOOK_COND include/linux/netfilter.h:288 [inline]
 ip6_output+0x1fa/0x420 net/ipv6/ip6_output.c:234
 dst_output include/net/dst.h:451 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 mld_sendpack+0x61e/0xb00 net/ipv6/mcast.c:1676
 mld_send_initial_cr+0x246/0x2b0 net/ipv6/mcast.c:2093
 ipv6_mc_dad_complete+0x76/0x3c0 net/ipv6/mcast.c:2100
 addrconf_dad_completed+0x74c/0xe30 net/ipv6/addrconf.c:4273
 addrconf_dad_work+0xc5f/0x1480 net/ipv6/addrconf.c:-1
 process_one_work+0x6fd/0xbc0 kernel/workqueue.c:2301
 worker_thread+0xa8e/0x13c0 kernel/workqueue.c:2447
 kthread+0x324/0x3b0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Allocated by task 84:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:430 [inline]
 __kasan_slab_alloc+0xb7/0xe0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x5d/0x2f0 mm/slab.h:580
 slab_alloc_node mm/slub.c:2952 [inline]
 slab_alloc mm/slub.c:2960 [inline]
 kmem_cache_alloc+0x15a/0x2d0 mm/slub.c:2965
 kmem_cache_alloc_node include/linux/slab.h:426 [inline]
 __alloc_skb+0x9e/0x520 net/core/skbuff.c:200
 alloc_skb include/linux/skbuff.h:1126 [inline]
 ncm_wrap_ntb+0x3a0/0xe40 drivers/usb/gadget/function/f_ncm.c:1072
 eth_start_xmit+0x48d/0xd40 drivers/usb/gadget/function/u_ether.c:552
 __netdev_start_xmit include/linux/netdevice.h:4864 [inline]
 netdev_start_xmit include/linux/netdevice.h:4878 [inline]
 xmit_one net/core/dev.c:3606 [inline]
 dev_hard_start_xmit+0x245/0x680 net/core/dev.c:3622
 sch_direct_xmit+0x26d/0x990 net/sched/sch_generic.c:339
 qdisc_restart net/sched/sch_generic.c:404 [inline]
 __qdisc_run+0xa3a/0x1400 net/sched/sch_generic.c:412
 qdisc_run+0x100/0x2f0 include/net/pkt_sched.h:126
 __dev_xmit_skb net/core/dev.c:3817 [inline]
 __dev_queue_xmit+0xbc6/0x2500 net/core/dev.c:4173
 dev_queue_xmit+0x17/0x20 net/core/dev.c:4254
 neigh_hh_output include/net/neighbour.h:501 [inline]
 neigh_output include/net/neighbour.h:515 [inline]
 ip6_finish_output2+0xea9/0x1540 net/ipv6/ip6_output.c:130
 __ip6_finish_output+0x5fd/0x790 net/ipv6/ip6_output.c:201
 ip6_finish_output+0x33/0x1e0 net/ipv6/ip6_output.c:211
 NF_HOOK_COND include/linux/netfilter.h:288 [inline]
 ip6_output+0x1fa/0x420 net/ipv6/ip6_output.c:234
 dst_output include/net/dst.h:451 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 mld_sendpack+0x61e/0xb00 net/ipv6/mcast.c:1676
 mld_send_cr net/ipv6/mcast.c:1972 [inline]
 mld_ifc_timer_expire+0x862/0xc60 net/ipv6/mcast.c:2471
 call_timer_fn+0x38/0x290 kernel/time/timer.c:1450
 expire_timers kernel/time/timer.c:1495 [inline]
 __run_timers+0x637/0x9a0 kernel/time/timer.c:1789
 run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1802
 __do_softirq+0x255/0x563 kernel/softirq.c:309

Freed by task 315:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1600 [inline]
 slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626
 slab_free mm/slub.c:3208 [inline]
 kmem_cache_free_bulk+0x4b3/0x6d0 mm/slub.c:3341
 __kfree_skb_flush+0xae/0x120 net/core/skbuff.c:876
 net_tx_action+0x32c/0x530 net/core/dev.c:4971
 __do_softirq+0x255/0x563 kernel/softirq.c:309

The buggy address belongs to the object at ffff88811e542280
 which belongs to the cache skbuff_head_cache of size 248
The buggy address is located 112 bytes inside of
 248-byte region [ffff88811e542280, ffff88811e542378)
The buggy address belongs to the page:
page:ffffea0004795080 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11e542
flags: 0x4000000000000200(slab)
raw: 4000000000000200 dead000000000100 dead000000000122 ffff888107d92a80
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 84, ts 27624504248, free_ts 26740677449
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x176/0x190 mm/page_alloc.c:2462
 get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1813 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1874
 new_slab_objects mm/slub.c:2632 [inline]
 ___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796
 __slab_alloc+0x63/0xa0 mm/slub.c:2836
 slab_alloc_node mm/slub.c:2918 [inline]
 slab_alloc mm/slub.c:2960 [inline]
 kmem_cache_alloc+0x1a4/0x2d0 mm/slub.c:2965
 kmem_cache_alloc_node include/linux/slab.h:426 [inline]
 __alloc_skb+0x9e/0x520 net/core/skbuff.c:200
 alloc_skb include/linux/skbuff.h:1126 [inline]
 alloc_skb_with_frags+0xa3/0x560 net/core/skbuff.c:6019
 sock_alloc_send_pskb+0x87f/0x9a0 net/core/sock.c:2393
 sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2410
 mld_newpack+0x1a3/0x9c0 net/ipv6/mcast.c:1604
 add_grhead net/ipv6/mcast.c:1707 [inline]
 add_grec+0xedf/0x1330 net/ipv6/mcast.c:1838
 mld_send_cr net/ipv6/mcast.c:1964 [inline]
 mld_ifc_timer_expire+0x797/0xc60 net/ipv6/mcast.c:2471
 call_timer_fn+0x38/0x290 kernel/time/timer.c:1450
 expire_timers kernel/time/timer.c:1495 [inline]
 __run_timers+0x637/0x9a0 kernel/time/timer.c:1789
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 free_pcp_prepare mm/page_alloc.c:1421 [inline]
 free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336
 free_unref_page mm/page_alloc.c:3391 [inline]
 free_the_page mm/page_alloc.c:5443 [inline]
 __free_pages+0x146/0x390 mm/page_alloc.c:5454
 free_pages+0x82/0x90 mm/page_alloc.c:5465
 kasan_depopulate_vmalloc_pte+0x6b/0x90 mm/kasan/shadow.c:354
 apply_to_pte_range mm/memory.c:2504 [inline]
 apply_to_pmd_range mm/memory.c:2540 [inline]
 apply_to_pud_range mm/memory.c:2568 [inline]
 apply_to_p4d_range mm/memory.c:2596 [inline]
 __apply_to_page_range+0x790/0xa20 mm/memory.c:2623
 apply_to_existing_page_range+0x38/0x50 mm/memory.c:2874
 kasan_release_vmalloc+0x97/0xb0 mm/kasan/shadow.c:464
 __purge_vmap_area_lazy+0x1326/0x1440 mm/vmalloc.c:1382
 _vm_unmap_aliases+0x2ec/0x370 mm/vmalloc.c:1779
 vm_unmap_aliases+0x19/0x20 mm/vmalloc.c:1802
 change_page_attr_set_clr+0x317/0xc10 arch/x86/mm/pat/set_memory.c:1732
 change_page_attr_clear arch/x86/mm/pat/set_memory.c:1789 [inline]
 set_memory_ro+0x89/0xd0 arch/x86/mm/pat/set_memory.c:1935
 bpf_jit_binary_lock_ro include/linux/filter.h:846 [inline]
 bpf_int_jit_compile+0x8473/0x8930 arch/x86/net/bpf_jit_comp.c:2134
 bpf_prog_select_runtime+0x722/0x9c0 kernel/bpf/core.c:1876
 bpf_migrate_filter net/core/filter.c:1306 [inline]
 bpf_prepare_filter+0xfab/0x1150 net/core/filter.c:1354
 __get_filter+0x2e2/0x410 net/core/filter.c:1523

Memory state around the buggy address:
 ffff88811e542180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811e542200: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
>ffff88811e542280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88811e542300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
 ffff88811e542380: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================
general protection fault, probably for non-canonical address 0xdffffc000000000e: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077]
CPU: 1 PID: 20 Comm: kworker/1:0 Tainted: G    B             syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Workqueue: ipv6_addrconf addrconf_dad_work
RIP: 0010:ncm_wrap_ntb+0x2a4/0xe40 drivers/usb/gadget/function/f_ncm.c:1059
Code: 48 c1 e8 03 80 3c 10 00 74 08 4c 89 f7 e8 34 36 90 fe 4d 8b 36 49 83 c6 70 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 73 0a 00 00 41 8b 06 48 8b 55 a8 41 8d 0c
RSP: 0018:ffffc90000156f50 EFLAGS: 00010002
RAX: 000000000000000e RBX: ffff88810d788c00 RCX: dffffc0000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 00000000ffffffff
RBP: ffffc90000156fd0 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffffbfff0dcf848 R12: 000000000000005a
R13: ffffffff855862e0 R14: 0000000000000070 R15: 000000000000000c
FS:  0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fff72edfce0 CR3: 000000011dcdd000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 eth_start_xmit+0x48d/0xd40 drivers/usb/gadget/function/u_ether.c:552
 __netdev_start_xmit include/linux/netdevice.h:4864 [inline]
 netdev_start_xmit include/linux/netdevice.h:4878 [inline]
 xmit_one net/core/dev.c:3606 [inline]
 dev_hard_start_xmit+0x245/0x680 net/core/dev.c:3622
 sch_direct_xmit+0x26d/0x990 net/sched/sch_generic.c:339
 qdisc_restart net/sched/sch_generic.c:404 [inline]
 __qdisc_run+0xa3a/0x1400 net/sched/sch_generic.c:412
 qdisc_run+0x100/0x2f0 include/net/pkt_sched.h:126
 __dev_xmit_skb net/core/dev.c:3817 [inline]
 __dev_queue_xmit+0xbc6/0x2500 net/core/dev.c:4173
 dev_queue_xmit+0x17/0x20 net/core/dev.c:4254
 neigh_hh_output include/net/neighbour.h:501 [inline]
 neigh_output include/net/neighbour.h:515 [inline]
 ip6_finish_output2+0xea9/0x1540 net/ipv6/ip6_output.c:130
 __ip6_finish_output+0x5fd/0x790 net/ipv6/ip6_output.c:201
 ip6_finish_output+0x33/0x1e0 net/ipv6/ip6_output.c:211
 NF_HOOK_COND include/linux/netfilter.h:288 [inline]
 ip6_output+0x1fa/0x420 net/ipv6/ip6_output.c:234
 dst_output include/net/dst.h:451 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 mld_sendpack+0x61e/0xb00 net/ipv6/mcast.c:1676
 mld_send_initial_cr+0x246/0x2b0 net/ipv6/mcast.c:2093
 ipv6_mc_dad_complete+0x76/0x3c0 net/ipv6/mcast.c:2100
 addrconf_dad_completed+0x74c/0xe30 net/ipv6/addrconf.c:4273
 addrconf_dad_work+0xc5f/0x1480 net/ipv6/addrconf.c:-1
 process_one_work+0x6fd/0xbc0 kernel/workqueue.c:2301
 worker_thread+0xa8e/0x13c0 kernel/workqueue.c:2447
 kthread+0x324/0x3b0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
Modules linked in:
---[ end trace c74935929314bb66 ]---
RIP: 0010:ncm_wrap_ntb+0x2a4/0xe40 drivers/usb/gadget/function/f_ncm.c:1059
Code: 48 c1 e8 03 80 3c 10 00 74 08 4c 89 f7 e8 34 36 90 fe 4d 8b 36 49 83 c6 70 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 73 0a 00 00 41 8b 06 48 8b 55 a8 41 8d 0c
RSP: 0018:ffffc90000156f50 EFLAGS: 00010002
RAX: 000000000000000e RBX: ffff88810d788c00 RCX: dffffc0000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 00000000ffffffff
RBP: ffffc90000156fd0 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffffbfff0dcf848 R12: 000000000000005a
R13: ffffffff855862e0 R14: 0000000000000070 R15: 000000000000000c
FS:  0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fff72edfce0 CR3: 000000011dcdd000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	48 c1 e8 03          	shr    $0x3,%rax
   4:	80 3c 10 00          	cmpb   $0x0,(%rax,%rdx,1)
   8:	74 08                	je     0x12
   a:	4c 89 f7             	mov    %r14,%rdi
   d:	e8 34 36 90 fe       	call   0xfe903646
  12:	4d 8b 36             	mov    (%r14),%r14
  15:	49 83 c6 70          	add    $0x70,%r14
  19:	4c 89 f0             	mov    %r14,%rax
  1c:	48 c1 e8 03          	shr    $0x3,%rax
  20:	48 b9 00 00 00 00 00 	movabs $0xdffffc0000000000,%rcx
  27:	fc ff df
* 2a:	0f b6 04 08          	movzbl (%rax,%rcx,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	0f 85 73 0a 00 00    	jne    0xaa9
  36:	41 8b 06             	mov    (%r14),%eax
  39:	48 8b 55 a8          	mov    -0x58(%rbp),%rdx
  3d:	41                   	rex.B
  3e:	8d                   	.byte 0x8d
  3f:	0c                   	.byte 0xc

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/17 08:29 android13-5.10-lts e334a66065d3 746171ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in ncm_wrap_ntb
* Struck through repros no longer work on HEAD.