Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ppp: disconnect channel before nullifying pch->chan

In ppp_unregister_channel(), pch->chan is set to NULL before calling
ppp_disconnect_channel(), which removes the channel from ppp->channels
list using list_del_rcu() + synchronize_net(). This creates an
intermediate state where the channel is still connected (on the list)
but already unregistered (pch->chan == NULL).

Call ppp_disconnect_channel() before setting pch->chan to NULL. After
the synchronize_net(), no new reader on the transmit path will hold a
reference to the channel from the list.

This eliminates the problematic state, and prepares for removing the
pch->chan NULL checks from the transmit path in a subsequent patch.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Link: https://patch.msgid.link/20260312093732.277254-1-dqfext@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Qingfang Deng and committed by
Paolo Abeni
6a196e83 a2efb1b8

+1 -1
+1 -1
drivers/net/ppp/ppp_generic.c
··· 3032 3032 * This ensures that we have returned from any calls into 3033 3033 * the channel's start_xmit or ioctl routine before we proceed. 3034 3034 */ 3035 + ppp_disconnect_channel(pch); 3035 3036 down_write(&pch->chan_sem); 3036 3037 spin_lock_bh(&pch->downl); 3037 3038 WRITE_ONCE(pch->chan, NULL); 3038 3039 spin_unlock_bh(&pch->downl); 3039 3040 up_write(&pch->chan_sem); 3040 - ppp_disconnect_channel(pch); 3041 3041 3042 3042 pn = ppp_pernet(pch->chan_net); 3043 3043 spin_lock_bh(&pn->all_channels_lock);