]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'ppp-recursion'
authorDavid S. Miller <davem@davemloft.net>
Wed, 31 Aug 2016 21:33:09 +0000 (14:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Aug 2016 21:33:09 +0000 (14:33 -0700)
commit940b2f2c9f69f23e3548636fc58cf925cc3c8d51
tree6defcfe2dc7552fa5a45072339b1e81c851a5ce0
parenta668ecc69b031fa8461a152489b141cf249b087b
parent254f2af5510182ca1e34898c30301b2bf2082f80
Merge branch 'ppp-recursion'

Guillaume Nault says:

====================
ppp: fix deadlock upon recursive xmit

This series fixes the issue reported by Feng where packets looping
through a ppp device makes the module deadlock:
https://marc.info/?l=linux-netdev&m=147134567319038&w=2

The problem can occur on virtual interfaces (e.g. PPP over L2TP, or
PPPoE on vxlan devices), when a PPP packet is routed back to the PPP
interface.

PPP's xmit path isn't reentrant, so patch #1 uses a per-cpu variable
to detect and break recursion. Patch #2 sets the NETIF_F_LLTX flag to
avoid lock inversion issues between ppp and txqueue locks.

There are multiple entry points to the PPP xmit path. This series has
been tested with lockdep and should address recursion issues no matter
how the packet entered the path.

A similar issue in L2TP is not covered by this series:
l2tp_xmit_skb() also isn't reentrant, and it can be called as part of
PPP's xmit path (pppol2tp_xmit()), or directly from the L2TP socket
(l2tp_ppp_sendmsg()). If a packet is sent by l2tp_ppp_sendmsg() and
routed to the parent PPP interface, then it's going to hit
l2tp_xmit_skb() again.

Breaking recursion as done in ppp_generic is not enough, because we'd
still have a lock inversion issue (locking in l2tp_xmit_skb() can
happen before or after locking in ppp_generic). The best approach would
be to use the ip_tunnel functions and remove the socket locking in
l2tp_xmit_skb(). But that'd be something for net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>