1
0

081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch 879 B

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