aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ppp
diff options
context:
space:
mode:
authorSimon Farnsworth <simon@farnz.org.uk>2015-03-01 05:54:39 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-02 00:17:31 -0500
commit287f3a943fef58c5c73e42545169443be379222f (patch)
treeaefaf8eb2c42acc7091a76a2f152dc8a3f62b3b1 /drivers/net/ppp
parent26caa3469a2de617d95c29371571a9585603a023 (diff)
pppoe: Use workqueue to die properly when a PADT is received
When a PADT frame is received, the socket may not be in a good state to close down the PPP interface. The current implementation handles this by simply blocking all further PPP traffic, and hoping that the lack of traffic will trigger the user to investigate. Use schedule_work to get to a process context from which we clear down the PPP interface, in a fashion analogous to hangup on a TTY-based PPP interface. This causes pppd to disconnect immediately, and allows tools to take immediate corrective action. Note that pppd's rp_pppoe.so plugin has code in it to disable the session when it disconnects; however, as a consequence of this patch, the session is already disabled before rp_pppoe.so is asked to disable the session. The result is a harmless error message: Failed to disconnect PPPoE socket: 114 Operation already in progress This message is safe to ignore, as long as the error is 114 Operation already in progress; in that specific case, it means that the PPPoE session has already been disabled before pppd tried to disable it. Signed-off-by: Simon Farnsworth <simon@farnz.org.uk> Tested-by: Dan Williams <dcbw@redhat.com> Tested-by: Christoph Schulz <develop@kristov.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp')
-rw-r--r--drivers/net/ppp/pppoe.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index d2408a5e43a6..9c97e9bcf5f5 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -455,6 +455,18 @@ out:
455 return NET_RX_DROP; 455 return NET_RX_DROP;
456} 456}
457 457
458static void pppoe_unbind_sock_work(struct work_struct *work)
459{
460 struct pppox_sock *po = container_of(work, struct pppox_sock,
461 proto.pppoe.padt_work);
462 struct sock *sk = sk_pppox(po);
463
464 lock_sock(sk);
465 pppox_unbind_sock(sk);
466 release_sock(sk);
467 sock_put(sk);
468}
469
458/************************************************************************ 470/************************************************************************
459 * 471 *
460 * Receive a PPPoE Discovery frame. 472 * Receive a PPPoE Discovery frame.
@@ -500,7 +512,8 @@ static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev,
500 } 512 }
501 513
502 bh_unlock_sock(sk); 514 bh_unlock_sock(sk);
503 sock_put(sk); 515 if (!schedule_work(&po->proto.pppoe.padt_work))
516 sock_put(sk);
504 } 517 }
505 518
506abort: 519abort:
@@ -613,6 +626,8 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
613 626
614 lock_sock(sk); 627 lock_sock(sk);
615 628
629 INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work);
630
616 error = -EINVAL; 631 error = -EINVAL;
617 if (sp->sa_protocol != PX_PROTO_OE) 632 if (sp->sa_protocol != PX_PROTO_OE)
618 goto end; 633 goto end;