forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork1
Commit6d06673
ppp: avoid loop in xmit recursion detection code
We already detect situations where a PPP channel sends packets back toits upper PPP device. While this is enough to avoid deadlocking on xmitlocks, this doesn't prevent packets from looping between the channeland the unit.The problem is that ppp_start_xmit() enqueues packets in ppp->file.xqbefore checking for xmit recursion. Therefore, __ppp_xmit_process()might dequeue a packet from ppp->file.xq and send it on the channelwhich, in turn, loops it back on the unit. Then ppp_start_xmit()queues the packet back to ppp->file.xq and __ppp_xmit_process() picksit up and sends it again through the channel. Therefore, the packetwill loop between __ppp_xmit_process() and ppp_start_xmit() until someother part of the xmit path drops it.For L2TP, we rapidly fill the skb's headroom and pppol2tp_xmit() dropsthe packet after a few iterations. But PPTP reallocates the headroomif necessary, letting the loop run and exhaust the machine resources(as reported inhttps://bugzilla.kernel.org/show_bug.cgi?id=199109).Fix this by letting __ppp_xmit_process() enqueue the skb toppp->file.xq, so that we can check for recursion before adding it tothe queue. Now ppp_xmit_process() can drop the packet when recursion isdetected.__ppp_channel_push() is a bit special. It calls __ppp_xmit_process()without having any actual packet to send. This is used byppp_output_wakeup() to re-enable transmission on the parent unit (forimplementations like ppp_async.c, where the .start_xmit() functionmight not consume the skb, leaving it in ppp->xmit_pending anddisabling transmission).Therefore, __ppp_xmit_process() needs to handle the case where skb isNULL, dequeuing as many packets as possible from ppp->file.xq.Reported-by: xu heng <xuheng333@zoho.com>Fixes:55454a5 ("ppp: avoid dealock on recursive xmit")Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>Signed-off-by: David S. Miller <davem@davemloft.net>1 parent8936ef7 commit6d06673
1 file changed
+14
-12
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
260 |
| - | |
| 260 | + | |
261 | 261 |
| |
262 | 262 |
| |
263 | 263 |
| |
| |||
513 | 513 |
| |
514 | 514 |
| |
515 | 515 |
| |
516 |
| - | |
517 |
| - | |
518 | 516 |
| |
519 | 517 |
| |
520 |
| - | |
| 518 | + | |
521 | 519 |
| |
522 | 520 |
| |
| 521 | + | |
523 | 522 |
| |
524 | 523 |
| |
525 | 524 |
| |
| |||
1267 | 1266 |
| |
1268 | 1267 |
| |
1269 | 1268 |
| |
1270 |
| - | |
1271 |
| - | |
| 1269 | + | |
| 1270 | + | |
1272 | 1271 |
| |
1273 | 1272 |
| |
1274 | 1273 |
| |
| |||
1420 | 1419 |
| |
1421 | 1420 |
| |
1422 | 1421 |
| |
1423 |
| - | |
| 1422 | + | |
1424 | 1423 |
| |
1425 |
| - | |
1426 |
| - | |
1427 | 1424 |
| |
1428 | 1425 |
| |
1429 | 1426 |
| |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
1430 | 1430 |
| |
1431 | 1431 |
| |
1432 | 1432 |
| |
| |||
1440 | 1440 |
| |
1441 | 1441 |
| |
1442 | 1442 |
| |
1443 |
| - | |
| 1443 | + | |
1444 | 1444 |
| |
1445 | 1445 |
| |
1446 | 1446 |
| |
1447 | 1447 |
| |
1448 | 1448 |
| |
1449 | 1449 |
| |
1450 | 1450 |
| |
1451 |
| - | |
| 1451 | + | |
1452 | 1452 |
| |
1453 | 1453 |
| |
1454 | 1454 |
| |
| |||
1458 | 1458 |
| |
1459 | 1459 |
| |
1460 | 1460 |
| |
| 1461 | + | |
| 1462 | + | |
1461 | 1463 |
| |
1462 | 1464 |
| |
1463 | 1465 |
| |
| |||
1942 | 1944 |
| |
1943 | 1945 |
| |
1944 | 1946 |
| |
1945 |
| - | |
| 1947 | + | |
1946 | 1948 |
| |
1947 | 1949 |
| |
1948 | 1950 |
| |
|
0 commit comments
Comments
(0)