KASAN: slab-use-after-free Read in ppp_disconnect_channel

Status: upstream: reported C repro on 2026/11/16 09:18
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+6b18da3ef22e33061add@syzkaller.appspotmail.com
First crash: 1d01h, last: 1d01h
✨ AI-generated root cause summary:

In ppp_unregister_channel(), ppp_disconnect_channel(pch) is invoked prior to clearing pch->chan. While ppp_disconnect_channel() disconnects the channel and waits in synchronize_net(), pch->ppp is NULL while pch->chan is still non-NULL, allowing a concurrent PPPIOCCONNECT ioctl to pass the !pch->chan check and re-attach the dying channel onto ppp->channels. Additionally, ppp_disconnect_channel() prematurely unlocks pch->upl after nullifying pch->ppp before acquiring ppp_lock(ppp) to delete pch->clist. As a result, the unregistering channel is queued for RCU release by ppp_release_channel() while its clist node remains linked into ppp->channels, causing a slab use-after-free and linked list corruption on subsequent operations.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 6964ff21c5d8:

Bug Technical Breakdown and Root Cause Analysis

1. Involved Components and Data Structures

  • Files: drivers/net/ppp/ppp_generic.c
  • Functions: ppp_unregister_channel(), ppp_disconnect_channel(), ppp_connect_channel(), ppp_release_channel()
  • Structures and Fields:
    • struct channel: represents a PPP channel (allocated from kmalloc-1k in ppp_register_net_channel()).
      • pch->chan: pointer to public struct ppp_channel; set to NULL upon unregistration.
      • pch->ppp: RCU-protected pointer to associated struct ppp unit.
      • pch->clist: struct list_head node linking this channel into ppp->channels (at offset 528 / 0x210).
      • pch->upl: spinlock protecting pch->ppp and pch->bridge.
      • pch->downl: spinlock protecting pch->chan.
    • struct ppp: represents a PPP unit device (struct net_device).
      • ppp->channels: struct list_head containing attached channels.
      • ppp->wlock / ppp->rlock: spinlocks acquired jointly by ppp_lock(ppp) protecting ppp->channels.

2. Root Cause Mechanism

The defect is caused by an unsynchronized race window during channel teardown and reconnection, allowing a dying channel to be linked back onto a PPP unit's channels list (ppp->channels) while in the process of being unregistered and freed.

A. Reconnection Race During ppp_unregister_channel()

In ppp_unregister_channel() (drivers/net/ppp/ppp_generic.c:3071):

void ppp_unregister_channel(struct ppp_channel *chan)
{
    struct channel *pch = chan->ppp;
    ...
    ppp_disconnect_channel(pch);
    mutex_lock(&pch->chan_sem);
    spin_lock_bh(&pch->downl);
    pch->chan = NULL;
    spin_unlock_bh(&pch->downl);
    mutex_unlock(&pch->chan_sem);
    ...
    ppp_release_channel(pch);
}
  1. In ppp_unregister_channel(), ppp_disconnect_channel(pch) is invoked before clearing pch->chan = NULL.
  2. Inside ppp_disconnect_channel(pch):
    • pch->ppp is replaced with NULL under pch->upl.
    • pch->clist is removed from ppp->channels under ppp_lock(ppp).
    • synchronize_net() is called to wait for packet processing RCU readers to drain.
  3. While ppp_disconnect_channel(pch) sleeps in synchronize_net() (or immediately after it returns before pch->downl is locked to clear pch->chan), pch->ppp is NULL, but pch->chan is still non-NULL.
  4. In ppp_ioctl(), PPPIOCCONNECT does not hold pch->chan_sem (which only guards default: ioctls). When a concurrent thread invokes ioctl(chan_fd, PPPIOCCONNECT, &unit) on an open channel file descriptor, ppp_connect_channel() (drivers/net/ppp/ppp_generic.c:3576) runs:
    • It checks if (pch->ppp || pch->bridge) under pch->upl, which passes because pch->ppp was set to NULL.
    • It acquires ppp_lock(ppp) and then pch->downl.
    • It validates if (!pch->chan) (/* Don't connect unregistered channels */). Because pch->chan has not been cleared yet, this check passes!
    • It inserts pch->clist back onto ppp->channels via list_add_tail_rcu(&pch->clist, &ppp->channels), sets rcu_assign_pointer(pch->ppp, ppp), and increments ppp->file.refcnt.
  5. Now ppp_unregister_channel() proceeds: it sets pch->chan = NULL, unlinks pch->list from pn->all_channels, marks pch->file.dead = 1, and drops its reference via ppp_release_channel(pch). It never calls ppp_disconnect_channel() again.
  6. When userspace subsequently closes chan_fd, ppp_release() (drivers/net/ppp/ppp_generic.c:419) calls ppp_release_channel(pch), dropping the last refcount. call_rcu(&pch->rcu, ppp_release_channel_free) is scheduled, and pch is freed by rcu_core -> kfree(pch).
  7. Invariant violation: pch is freed while pch->clist is still actively linked into ppp->channels.
B. Premature Lock Release in ppp_disconnect_channel()

A related synchronization flaw exists in ppp_disconnect_channel() (drivers/net/ppp/ppp_generic.c:3634):

static int ppp_disconnect_channel(struct channel *pch)
{
    struct ppp *ppp;
    int err = -EINVAL;

    spin_lock(&pch->upl);
    ppp = rcu_replace_pointer(pch->ppp, NULL, lockdep_is_held(&pch->upl));
    spin_unlock(&pch->upl);
    if (ppp) {
        ppp_lock(ppp);
        list_del_rcu(&pch->clist);
        ...
        ppp_unlock(ppp);

pch->upl is released after clearing pch->ppp before taking ppp_lock(ppp) to delete pch->clist, despite the documented lock ordering (channel.upl -> ppp.wlock -> ppp.rlock -> channel.downl). During this window, pch->ppp == NULL while pch->clist is still linked in ppp->channels. If PPPIOCCONNECT runs concurrently on another thread, it sees pch->ppp == NULL, takes ppp_lock(ppp), and adds pch->clist onto ppp->channels again (a double list_add), followed by list_del_rcu(&pch->clist) from the disconnect thread, leaving corrupted list pointers.


3. How the Reported Failure Occurs

  1. In iteration $N$, channel pch_N is attached to unit ppp.
  2. Teardown begins (close(pty_fd) -> ppp_unregister_channel()), and a concurrent worker executing PPPIOCCONNECT re-attaches pch_N into ppp->channels.
  3. chan_fd is closed, queuing pch_N for RCU destruction (ppp_release_channel_free()).
  4. In iteration $N+1$, a new channel pch_{N+1} connects to the same ppp unit. list_add_tail_rcu(&pch_{N+1}->clist, &ppp->channels) links pch_{N+1}->clist.prev to &pch_N->clist.
  5. RCU grace period elapses and pch_N is freed (kfree()).
  6. Channel pch_{N+1} is subsequently disconnected (close(pty_fd) -> ppp_asynctty_close() -> ppp_unregister_channel() -> ppp_disconnect_channel()).
  7. ppp_disconnect_channel() calls list_del_rcu(&pch_{N+1}->clist).
  8. __list_del_entry_valid_or_report() inspects entry->prev->next (line 62 of lib/list_debug.c). Because entry->prev points to &pch_N->clist at offset 528 (0x210) inside the freed pch_N allocation, KASAN detects a slab-use-after-free read at ffff88807ee8aa10.
▶ ▼ ✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision
ae0f0395 assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ✅ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ KASAN: slab-use-after-free Read in ppp_disconnect_channel 2026/11/15 08:29 2026/11/15 08:29 2026/11/15 09:10 819ebe34
▶ ▼ Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: slab-use-after-free Read in ppp_disconnect_channel 0 (1) 2026/11/16 09:18

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __list_del_entry_valid_or_report+0x92/0x190 lib/list_debug.c:62
Read of size 8 at addr ffff88807ee8aa10 by task syz-executor994/6046

CPU: 0 UID: 0 PID: 6046 Comm: syz-executor994 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 __list_del_entry_valid_or_report+0x92/0x190 lib/list_debug.c:62
 __list_del_entry_valid include/linux/list.h:140 [inline]
 __list_del_entry include/linux/list.h:261 [inline]
 list_del_rcu include/linux/rculist.h:178 [inline]
 ppp_disconnect_channel+0xd6/0x2a0 drivers/net/ppp/ppp_generic.c:3645
 ppp_unregister_channel+0x64/0x270 drivers/net/ppp/ppp_generic.c:3085
 ppp_asynctty_close+0x79/0x110 drivers/net/ppp/ppp_async.c:183
 tty_ldisc_kill drivers/tty/tty_ldisc.c:613 [inline]
 tty_ldisc_release+0x23f/0x520 drivers/tty/tty_ldisc.c:781
 tty_release_struct+0x2a/0xd0 drivers/tty/tty_io.c:1656
 tty_release+0xc62/0x1670 drivers/tty/tty_io.c:1827
 __fput+0x408/0xa40 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:618
 filp_close_sync fs/open.c:1574 [inline]
 __do_sys_close fs/open.c:1597 [inline]
 __se_sys_close+0xa2/0x160 fs/open.c:1584
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa749932e5e
Code: 08 0f 85 f5 e2 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 90 41 57 41 56 4d 89 c6 41 55 4d 89 cd 41 54 55 53 48 83 ec 08
RSP: 002b:00007ffdce7a74b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 0000555594214400 RCX: 00007fa749932e5e
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000005 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: 00007ffdce7a7540 R14: 00007ffdce7a7538 R15: 00007ffdce7a7570
 </TASK>

Allocated by task 6046:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:409 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:426
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x31c/0x600 mm/slub.c:5680
 _kmalloc_noprof include/linux/slab.h:991 [inline]
 _kzalloc_noprof include/linux/slab.h:1312 [inline]
 ppp_register_net_channel+0x58/0x770 drivers/net/ppp/ppp_generic.c:2989
 ppp_asynctty_open+0x331/0x4c0 drivers/net/ppp/ppp_async.c:154
 tty_ldisc_open+0xa1/0x100 drivers/tty/tty_ldisc.c:432
 tty_set_ldisc+0x365/0x540 drivers/tty/tty_ldisc.c:563
 tty_ioctl+0xc30/0xde0 drivers/tty/tty_io.c:2718
 vfs_ioctl fs/ioctl.c:52 [inline]
 __do_sys_ioctl fs/ioctl.c:598 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6059:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:264 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:296
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2780 [inline]
 slab_free mm/slub.c:6630 [inline]
 kfree+0x1c5/0x650 mm/slub.c:6923
 rcu_do_batch kernel/rcu/tree.c:2650 [inline]
 rcu_core+0x92e/0x1230 kernel/rcu/tree.c:2919
 handle_softirqs+0x265/0x8d0 kernel/softirq.c:669
 __do_softirq kernel/softirq.c:703 [inline]
 invoke_softirq kernel/softirq.c:542 [inline]
 __irq_exit_rcu+0xc6/0x220 kernel/softirq.c:786
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:809
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:57
 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:556
 __call_rcu_common kernel/rcu/tree.c:3287 [inline]
 call_rcu+0x86/0x300 kernel/rcu/tree.c:3395
 ppp_release+0x98/0x130 drivers/net/ppp/ppp_generic.c:419
 __fput+0x408/0xa40 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:618
 filp_close_sync fs/open.c:1574 [inline]
 __do_sys_close fs/open.c:1597 [inline]
 __se_sys_close+0xa2/0x160 fs/open.c:1584
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88807ee8a800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 528 bytes inside of
 freed 1024-byte region [ffff88807ee8a800, ffff88807ee8ac00)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88807ee8b800 pfn:0x7ee88
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000240 ffff88813ff25dc0 ffffea0000d8da10 ffffea0000a40a10
raw: ffff88807ee8b800 000000000010000d 00000000f5000000 0000000000000000
head: 00fff00000000240 ffff88813ff25dc0 ffffea0000d8da10 ffffea0000a40a10
head: ffff88807ee8b800 000000000010000d 00000000f5000000 0000000000000000
head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5684, tgid 5684 (syz-executor), ts 79942213210
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1860
 prep_new_page mm/page_alloc.c:1868 [inline]
 get_page_from_freelist+0x225d/0x22e0 mm/page_alloc.c:3950
 __alloc_frozen_pages_noprof+0x211/0x450 mm/page_alloc.c:5492
 alloc_slab_page mm/slub.c:3384 [inline]
 allocate_slab+0x7d/0x5e0 mm/slub.c:3499
 new_slab mm/slub.c:3550 [inline]
 refill_objects+0x2d5/0x350 mm/slub.c:7539
 refill_sheaf mm/slub.c:2917 [inline]
 __pcs_replace_empty_main+0x2c8/0x6c0 mm/slub.c:4811
 alloc_from_pcs mm/slub.c:4887 [inline]
 slab_alloc_node mm/slub.c:5021 [inline]
 __do_kmalloc_node mm/slub.c:5530 [inline]
 __kmalloc_noprof+0x476/0x710 mm/slub.c:5556
 _kmalloc_noprof include/linux/slab.h:995 [inline]
 _kzalloc_noprof include/linux/slab.h:1312 [inline]
 ip6t_alloc_initial_table+0x6b/0x6d0 net/ipv6/netfilter/ip6_tables.c:40
 ip6table_filter_table_init+0x1c/0xb0 net/ipv6/netfilter/ip6table_filter.c:41
 xt_find_table_lock+0x311/0x400 net/netfilter/x_tables.c:1353
 xt_request_find_table_lock+0x26/0x100 net/netfilter/x_tables.c:1378
 get_info net/ipv6/netfilter/ip6_tables.c:983 [inline]
 do_ip6t_get_ctl+0x77b/0x12f0 net/ipv6/netfilter/ip6_tables.c:1675
 nf_getsockopt+0x26e/0x290 net/netfilter/nf_sockopt.c:116
 ipv6_getsockopt+0x34e/0x420 net/ipv6/ipv6_sockglue.c:1385
 do_sock_getsockopt+0x4aa/0x640 net/socket.c:2505
 __sys_getsockopt net/socket.c:2536 [inline]
 __do_sys_getsockopt net/socket.c:2543 [inline]
 __se_sys_getsockopt net/socket.c:2540 [inline]
 __x64_sys_getsockopt+0x1a4/0x240 net/socket.c:2540
page last free pid 3332 tgid 3332 ts 79846699335 stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 __free_pages_prepare mm/page_alloc.c:1402 [inline]
 __free_frozen_pages+0xd1a/0xe10 mm/page_alloc.c:2958
 __slab_free+0x269/0x2c0 mm/slub.c:5926
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x99/0x100 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:361
 kasan_slab_alloc include/linux/kasan.h:253 [inline]
 slab_post_alloc_hook mm/slub.c:4720 [inline]
 slab_alloc_node mm/slub.c:5033 [inline]
 kmem_cache_alloc_node_noprof+0x34f/0x600 mm/slub.c:5105
 __alloc_skb+0x1db/0x7a0 net/core/skbuff.c:707
 alloc_skb include/linux/skbuff.h:1395 [inline]
 nlmsg_new include/net/netlink.h:1055 [inline]
 inet6_ifmcaddr_notify+0xfa/0x1e0 net/ipv6/mcast.c:940
 __ipv6_dev_mc_dec+0x2f3/0x3a0 net/ipv6/mcast.c:1038
 ipv6_mc_destroy_dev+0x33a/0x590 net/ipv6/mcast.c:2902
 addrconf_ifdown+0x1662/0x1bd0 net/ipv6/addrconf.c:4076
 addrconf_notify+0x1bc/0x1050 net/ipv6/addrconf.c:-1
 notifier_call_chain+0x1a5/0x3d0 kernel/notifier.c:86
 call_netdevice_notifiers_extack net/core/dev.c:2351 [inline]
 call_netdevice_notifiers net/core/dev.c:2365 [inline]
 unregister_netdevice_many_notify+0x1432/0x1dc0 net/core/dev.c:12802
 ops_exit_rtnl_list net/core/net_namespace.c:188 [inline]
 ops_undo_list+0x391/0x8f0 net/core/net_namespace.c:249
 cleanup_net+0x578/0x810 net/core/net_namespace.c:713

Memory state around the buggy address:
 ffff88807ee8a900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807ee8a980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807ee8aa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88807ee8aa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807ee8ab00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/15 08:29 git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 6964ff21c5d8 d6166547 .config console log report C ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in ppp_disconnect_channel
* Struck through repros no longer work on HEAD.