BUG: corrupted list in ppp_connect_channel

Status: moderation: reported on 2026/11/16 22:53
Subsystems: ppp
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+06faffc2605096aa2fa8@syzkaller.appspotmail.com
First crash: 4d06h, last: 4d06h
✨ AI-generated root cause summary:

A concurrency bug exists between channel disconnection in ppp_disconnect_channel() and channel connection in ppp_connect_channel() within drivers/net/ppp/ppp_generic.c. In ppp_disconnect_channel(), pch->upl is released immediately after setting pch->ppp to NULL, before taking ppp_lock(ppp) and removing pch->clist from ppp->channels via list_del_rcu(). Because ppp_unregister_channel() invokes ppp_disconnect_channel() without holding ppp_mutex, a concurrent ioctl(PPPIOCCONNECT) can observe pch->ppp == NULL under pch->upl, acquire ppp_lock(ppp), and attempt to insert pch->clist back into ppp->channels using list_add_tail_rcu() while pch->clist is still linked to the list. This violates linked-list invariants (new == prev) and triggers a kernel BUG in __list_add_valid_or_report().

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

Root Cause Analysis

1. Involved Entities and Files

  • Source File: drivers/net/ppp/ppp_generic.c
  • Functions:
    • ppp_disconnect_channel(struct channel *pch) (lines 3636–3657)
    • ppp_connect_channel(struct channel *pch, int unit) (lines 3579–3631)
    • ppp_unregister_channel(struct ppp_channel *chan) (lines 3074–3106)
    • ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) (lines 712–797)
  • Structs and Fields:
    • struct channel (pch->upl, pch->ppp, pch->clist, pch->chan, pch->downl)
    • struct ppp (ppp->channels, ppp->n_channels, ppp->wlock, ppp->rlock)

2. Technical Mechanism and Invariant Violation

In the PPP subsystem, a channel (struct channel *pch) represents a communication link that can be connected to a PPP network interface unit (struct ppp *ppp).

  • The channel's membership in the unit's channel list (ppp->channels) is tracked through pch->clist.
  • The unit pointer pch->ppp indicates whether the channel is currently connected, and is documented in comments (line 205) to be protected by pch->upl.
  • The locking hierarchy documented at line 205 is:
    channel.upl -> ppp.wlock -> ppp.rlock -> channel.downl
    
    where ppp_lock(ppp) acquires both ppp->wlock and ppp->rlock.
Flaw in ppp_disconnect_channel()

In ppp_disconnect_channel():

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) {
		/* remove it from the ppp unit's list */
		ppp_lock(ppp);
		list_del_rcu(&pch->clist);
		...
		ppp_unlock(ppp);
		...
	}
	return err;
}

At line 3643, pch->ppp is cleared to NULL while holding pch->upl. However, pch->upl is immediately unlocked at line 3644 before acquiring ppp_lock(ppp) and calling list_del_rcu(&pch->clist) at line 3648. This creates an inconsistent intermediate state where pch->ppp == NULL, but pch->clist remains linked to ppp->channels.

The Race with ppp_connect_channel()

ppp_unregister_channel() is invoked when an underlying channel driver or socket is closed/released (e.g., pppox_unbind_sock(), ppp_asynctty_close(), ppp_sync_close()). It calls ppp_disconnect_channel(pch) without holding ppp_mutex.

At the same time, userspace can execute ioctl(fd, PPPIOCCONNECT, &unit) on an open /dev/ppp channel descriptor (pf->kind == CHANNEL). This enters ppp_ioctl() and calls ppp_connect_channel(pch, unit):

static int
ppp_connect_channel(struct channel *pch, int unit)
{
	...
	mutex_lock(&pn->all_ppp_mutex);
	ppp = ppp_find_unit(pn, unit);
	...
	spin_lock(&pch->upl);
	ret = -EINVAL;
	if (rcu_dereference_protected(pch->ppp, lockdep_is_held(&pch->upl)) ||
	    rcu_dereference_protected(pch->bridge, lockdep_is_held(&pch->upl)))
		goto outl;

	ppp_lock(ppp);
	spin_lock_bh(&pch->downl);
	if (!pch->chan) {
		...
	}
	...
	list_add_tail_rcu(&pch->clist, &ppp->channels);
	...
	rcu_assign_pointer(pch->ppp, ppp);
	...
	ppp_unlock(ppp);
	...
 outl:
	spin_unlock(&pch->upl);

When ppp_disconnect_channel() releases pch->upl between lines 3644 and 3647:

  1. ppp_connect_channel() acquires pch->upl.
  2. It evaluates if (pch->ppp || pch->bridge) at lines 3596–3597. Because ppp_disconnect_channel() already set pch->ppp = NULL, this check passes.
  3. ppp_connect_channel() proceeds to acquire ppp_lock(ppp) for the PPP unit before ppp_disconnect_channel() does.
  4. Under pch->downl, pch->chan is still non-NULL because ppp_unregister_channel() only sets pch->chan = NULL at lines 3090–3092 after ppp_disconnect_channel() returns.
  5. ppp_connect_channel() executes list_add_tail_rcu(&pch->clist, &ppp->channels) at line 3619.

3. Failure Manifestation

Because pch->clist was never unlinked by ppp_disconnect_channel(), pch->clist is already in ppp->channels. In list_add_tail_rcu(new, head):

  • new = &pch->clist (0xffff88803602fa10)
  • next = head = &ppp->channels (0xffff88802da99020)
  • prev = head->prev (0xffff88803602fa10), which already points to &pch->clist

Validation inside __list_add_valid_or_report() (lib/list_debug.c:35-37) evaluates:

CHECK_DATA_CORRUPTION(new == prev || new == next, NULL,
	"list_add double add: new=%px, prev=%px, next=%px.\n",
	new, prev, next)

Since new == prev, the check fails, outputs:

list_add double add: new=ffff88803602fa10, prev=ffff88803602fa10, next=ffff88802da99020.

and triggers kernel BUG at lib/list_debug.c:37!.

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
c0e957e5 repro-c Reproduced: ✅ ❓ BUG: corrupted list in ppp_connect_channel 2026/11/15 06:00 2026/11/15 06:00 2026/11/15 07:42 819ebe34
3907ea6e assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ✅ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ BUG: corrupted list in ppp_connect_channel 2026/11/12 22:02 2026/11/12 22:02 2026/11/12 22:41 c0087d7f
▶ ▼ Last patch testing requests (1)
Created Duration User Patch Repo Result
2026/11/15 08:05 24m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 6964ff21c5d8b75649211a52dbfd92753e605649 report job log log

Sample crash report:
netlink: 'syz.3.1462': attribute type 10 has an invalid length.
list_add double add: new=ffff88803602fa10, prev=ffff88803602fa10, next=ffff88802da99020.
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:37!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 12185 Comm: syz.3.1462 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:__list_add_valid_or_report+0xa5/0x130 lib/list_debug.c:35
Code: 74 12 b0 01 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc 48 c7 c7 60 a4 8e 8c 4c 89 fe 4c 89 f2 48 89 d9 e8 cc 37 2c fc 90 <0f> 0b 48 c7 c7 40 a2 8e 8c e8 bd 37 2c fc 90 0f 0b 48 c7 c7 00 a3
RSP: 0018:ffffc90003c0fcd0 EFLAGS: 00010246
RAX: 0000000000000058 RBX: ffff88802da99020 RCX: 5b1541567150c600
RDX: 0000000000000000 RSI: 8000000000000403 RDI: 0000000000000000
RBP: 1ffff11005b53205 R08: ffffc90003c0fa47 R09: 1ffff92000781f48
R10: dffffc0000000000 R11: fffff52000781f49 R12: 1ffff11006c05f42
R13: dffffc0000000000 R14: ffff88803602fa10 R15: ffff88803602fa10
FS:  00007fb6a90f56c0(0000) GS:ffff888123509000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff28d1556c8 CR3: 000000007e810000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 __list_add_valid include/linux/list.h:104 [inline]
 __list_add_rcu include/linux/rculist.h:100 [inline]
 list_add_tail_rcu include/linux/rculist.h:149 [inline]
 ppp_connect_channel+0x4e8/0x7e0 drivers/net/ppp/ppp_generic.c:3619
 ppp_ioctl+0xc5f/0x1c00 drivers/net/ppp/ppp_generic.c:757
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:597 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb6a81a94d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fb6a90f5028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fb6a8426180 RCX: 00007fb6a81a94d9
RDX: 00002000000000c0 RSI: 000000004004743a RDI: 0000000000000008
RBP: 00007fb6a823804e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fb6a8426218 R14: 00007fb6a8426180 R15: 00007ffec3870378
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_add_valid_or_report+0xa5/0x130 lib/list_debug.c:35
Code: 74 12 b0 01 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc 48 c7 c7 60 a4 8e 8c 4c 89 fe 4c 89 f2 48 89 d9 e8 cc 37 2c fc 90 <0f> 0b 48 c7 c7 40 a2 8e 8c e8 bd 37 2c fc 90 0f 0b 48 c7 c7 00 a3
RSP: 0018:ffffc90003c0fcd0 EFLAGS: 00010246
RAX: 0000000000000058 RBX: ffff88802da99020 RCX: 5b1541567150c600
RDX: 0000000000000000 RSI: 8000000000000403 RDI: 0000000000000000
RBP: 1ffff11005b53205 R08: ffffc90003c0fa47 R09: 1ffff92000781f48
R10: dffffc0000000000 R11: fffff52000781f49 R12: 1ffff11006c05f42
R13: dffffc0000000000 R14: ffff88803602fa10 R15: ffff88803602fa10
FS:  00007fb6a90f56c0(0000) GS:ffff888123509000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff28d1556c8 CR3: 000000007e810000 CR4: 00000000003526f0

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/12 17:06 net-next c88fd6989aea d6166547 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce BUG: corrupted list in ppp_connect_channel
* Struck through repros no longer work on HEAD.