linux/drivers/net/ppp
Sebastian Andrzej Siewior d4f6460a4b ppp: Replace per-CPU recursion counter with lock-owner field
The per-CPU variable ppp::xmit_recursion is protecting against recursion
due to wrong configuration of the ppp unit. The per-CPU variable
relies on disabled BH for its locking. Without per-CPU locking in
local_bh_disable() on PREEMPT_RT this data structure requires explicit
locking.

The ppp::xmit_recursion is used as a per-CPU boolean. The counter is
checked early in the send routing and the transmit path is only entered
if the counter is zero. Then the counter is incremented to avoid
recursion. It used to detect recursion on channel::downl and
ppp::wlock.

Create a struct ppp_xmit_recursion and move the counter into it.
Add local_lock_t to the struct and use local_lock_nested_bh() for
locking. Due to possible nesting, the lock cannot be acquired
unconditionally but it requires an owner field to identify recursion
before attempting to acquire the lock.

The counter is incremented and checked only after the lock is acquired.
Since it functions as a boolean rather than a count, and its role is now
superseded by the owner field, it can be safely removed.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://patch.msgid.link/20250715150806.700536-2-bigeasy@linutronix.de
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2025-07-17 15:36:18 +02:00
..
bsd_comp.c net: fill in MODULE_DESCRIPTION()s for ppp 2024-02-15 08:03:46 -08:00
Kconfig net/pppoe: fix a typo for the PPPOE_HASH_BITS_1 definition 2023-06-06 13:28:30 +02:00
Makefile
ppp_async.c ppp: fix ppp_async_encode() illegal access 2024-10-10 08:47:13 -07:00
ppp_deflate.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
ppp_generic.c ppp: Replace per-CPU recursion counter with lock-owner field 2025-07-17 15:36:18 +02:00
ppp_mppe.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
ppp_mppe.h
ppp_synctty.c net: ppp: Add bound checking for skb data on ppp_sync_txmung 2025-04-10 11:24:17 +02:00
pppoe.c pppoe: drop PACKET_OTHERHOST before skb_share_check() 2025-06-24 16:37:02 -07:00
pppox.c
pptp.c ppp: use IFF_NO_QUEUE in virtual interfaces 2025-03-04 17:11:17 -08:00