aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-12-25 20:11:34 +0100
committerJohn Crispin <john@phrozen.org>2017-08-05 08:46:36 +0200
commit74d00a8c3849c1340efd713eb94b786e304c201f (patch)
treede481743de61c34da96ab5f9dba3af3edcfb8260 /target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch
parentde350550ef648d9728351b986b0516fa29465c45 (diff)
downloadupstream-74d00a8c3849c1340efd713eb94b786e304c201f.tar.gz
upstream-74d00a8c3849c1340efd713eb94b786e304c201f.tar.bz2
upstream-74d00a8c3849c1340efd713eb94b786e304c201f.zip
kernel: split patches folder up into backport, pending and hack folders
* properly format/comment all patches * merge debloat patches * merge Kconfig patches * merge swconfig patches * merge hotplug patches * drop 200-fix_localversion.patch - upstream * drop 222-arm_zimage_none.patch - unused * drop 252-mv_cesa_depends.patch - no longer required * drop 410-mtd-move-forward-declaration-of-struct-mtd_info.patch - unused * drop 661-fq_codel_keep_dropped_stats.patch - outdated * drop 702-phy_add_aneg_done_function.patch - upstream * drop 840-rtc7301.patch - unused * drop 841-rtc_pt7c4338.patch - upstream * drop 921-use_preinit_as_init.patch - unused * drop spio-gpio-old and gpio-mmc - unused Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch')
-rw-r--r--target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch b/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch
new file mode 100644
index 0000000000..347049a924
--- /dev/null
+++ b/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch
@@ -0,0 +1,89 @@
+From: Simon Farnsworth <simon@farnz.org.uk>
+Date: Sun, 1 Mar 2015 10:54:39 +0000
+Subject: [PATCH] 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>
+---
+
+--- a/drivers/net/ppp/pppoe.c
++++ b/drivers/net/ppp/pppoe.c
+@@ -454,6 +454,18 @@ out:
+ return NET_RX_DROP;
+ }
+
++static void pppoe_unbind_sock_work(struct work_struct *work)
++{
++ struct pppox_sock *po = container_of(work, struct pppox_sock,
++ proto.pppoe.padt_work);
++ struct sock *sk = sk_pppox(po);
++
++ lock_sock(sk);
++ pppox_unbind_sock(sk);
++ release_sock(sk);
++ sock_put(sk);
++}
++
+ /************************************************************************
+ *
+ * Receive a PPPoE Discovery frame.
+@@ -499,7 +511,8 @@ static int pppoe_disc_rcv(struct sk_buff
+ }
+
+ bh_unlock_sock(sk);
+- sock_put(sk);
++ if (!schedule_work(&po->proto.pppoe.padt_work))
++ sock_put(sk);
+ }
+
+ abort:
+@@ -612,6 +625,8 @@ static int pppoe_connect(struct socket *
+
+ lock_sock(sk);
+
++ INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work);
++
+ error = -EINVAL;
+ if (sp->sa_protocol != PX_PROTO_OE)
+ goto end;
+--- a/include/linux/if_pppox.h
++++ b/include/linux/if_pppox.h
+@@ -19,6 +19,7 @@
+ #include <linux/netdevice.h>
+ #include <linux/ppp_channel.h>
+ #include <linux/skbuff.h>
++#include <linux/workqueue.h>
+ #include <uapi/linux/if_pppox.h>
+
+ static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
+@@ -32,6 +33,7 @@ struct pppoe_opt {
+ struct pppoe_addr pa; /* what this socket is bound to*/
+ struct sockaddr_pppox relay; /* what socket data will be
+ relayed to (PPPoE relaying) */
++ struct work_struct padt_work;/* Work item for handling PADT */
+ };
+
+ struct pptp_opt {