081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From: Guillaume Nault <g.nault@alphalink.fr>
  2. Date: Thu, 19 Nov 2015 12:52:56 +0100
  3. Subject: [PATCH] ppp: don't set sk_state to PPPOX_ZOMBIE in pppoe_disc_rcv()
  4. Since 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT
  5. is received"), pppoe_disc_rcv() disconnects the socket by scheduling
  6. pppoe_unbind_sock_work(). This is enough to stop socket transmission
  7. and makes the PPPOX_ZOMBIE state uncessary.
  8. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
  9. Signed-off-by: David S. Miller <davem@davemloft.net>
  10. ---
  11. --- a/drivers/net/ppp/pppoe.c
  12. +++ b/drivers/net/ppp/pppoe.c
  13. @@ -500,27 +500,9 @@ static int pppoe_disc_rcv(struct sk_buff
  14. pn = pppoe_pernet(dev_net(dev));
  15. po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
  16. - if (po) {
  17. - struct sock *sk = sk_pppox(po);
  18. -
  19. - bh_lock_sock(sk);
  20. -
  21. - /* If the user has locked the socket, just ignore
  22. - * the packet. With the way two rcv protocols hook into
  23. - * one socket family type, we cannot (easily) distinguish
  24. - * what kind of SKB it is during backlog rcv.
  25. - */
  26. - if (sock_owned_by_user(sk) == 0) {
  27. - /* We're no longer connect at the PPPOE layer,
  28. - * and must wait for ppp channel to disconnect us.
  29. - */
  30. - sk->sk_state = PPPOX_ZOMBIE;
  31. - }
  32. -
  33. - bh_unlock_sock(sk);
  34. + if (po)
  35. if (!schedule_work(&po->proto.pppoe.padt_work))
  36. - sock_put(sk);
  37. - }
  38. + sock_put(sk_pppox(po));
  39. abort:
  40. kfree_skb(skb);