f672c67b90bf6e8dabbb0cce9c93941d242deb46
[openwrt/openwrt.git] / target / linux / generic / patches-3.18 / 081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Sat, 9 May 2015 23:08:38 +0200
3 Subject: [PATCH] pppoe: drop pppoe device in pppoe_unbind_sock_work
4
5 After receiving a PADT and the socket is closed, user space will no
6 longer drop the reference to the pppoe device.
7 This leads to errors like this:
8
9 [ 488.570000] unregister_netdevice: waiting for eth0.2 to become free. Usage count = 2
10
11 Fixes: 287f3a943fe ("pppoe: Use workqueue to die properly when a PADT is received")
12 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15
16 --- a/drivers/net/ppp/pppoe.c
17 +++ b/drivers/net/ppp/pppoe.c
18 @@ -465,6 +465,10 @@ static void pppoe_unbind_sock_work(struc
19 struct sock *sk = sk_pppox(po);
20
21 lock_sock(sk);
22 + if (po->pppoe_dev) {
23 + dev_put(po->pppoe_dev);
24 + po->pppoe_dev = NULL;
25 + }
26 pppox_unbind_sock(sk);
27 release_sock(sk);
28 sock_put(sk);