Commit 7521cd43 authored by David S. Miller's avatar David S. Miller

Merge branch 'ppp-kill-zombie-state'

Guillaume Nault says:

====================
ppp: Remove PPPOX_ZOMBIE socket state

Several issues have been found lately wrt. the PPPOX_ZOMBIE socket
state. This state is now only set upon reception of a PADT to stop
further transmissions. However this is redundant with the PADT
workqueue mechanism introduced by 287f3a94 ("pppoe: Use workqueue
to die properly when a PADT is received").

We can thus simplify pppox socket state handling by getting rid of
PPPOX_ZOMBIE entirely.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents bdc17fad a8acce6a
...@@ -311,7 +311,7 @@ static void pppoe_flush_dev(struct net_device *dev) ...@@ -311,7 +311,7 @@ static void pppoe_flush_dev(struct net_device *dev)
lock_sock(sk); lock_sock(sk);
if (po->pppoe_dev == dev && if (po->pppoe_dev == dev &&
sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
pppox_unbind_sock(sk); pppox_unbind_sock(sk);
sk->sk_state_change(sk); sk->sk_state_change(sk);
po->pppoe_dev = NULL; po->pppoe_dev = NULL;
...@@ -500,27 +500,9 @@ static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -500,27 +500,9 @@ static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev,
pn = pppoe_pernet(dev_net(dev)); pn = pppoe_pernet(dev_net(dev));
po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
if (po) { if (po)
struct sock *sk = sk_pppox(po);
bh_lock_sock(sk);
/* If the user has locked the socket, just ignore
* the packet. With the way two rcv protocols hook into
* one socket family type, we cannot (easily) distinguish
* what kind of SKB it is during backlog rcv.
*/
if (sock_owned_by_user(sk) == 0) {
/* We're no longer connect at the PPPOE layer,
* and must wait for ppp channel to disconnect us.
*/
sk->sk_state = PPPOX_ZOMBIE;
}
bh_unlock_sock(sk);
if (!schedule_work(&po->proto.pppoe.padt_work)) if (!schedule_work(&po->proto.pppoe.padt_work))
sock_put(sk); sock_put(sk_pppox(po));
}
abort: abort:
kfree_skb(skb); kfree_skb(skb);
...@@ -793,7 +775,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, ...@@ -793,7 +775,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
struct pppox_sock *relay_po; struct pppox_sock *relay_po;
err = -EBUSY; err = -EBUSY;
if (sk->sk_state & (PPPOX_BOUND | PPPOX_ZOMBIE | PPPOX_DEAD)) if (sk->sk_state & (PPPOX_BOUND | PPPOX_DEAD))
break; break;
err = -ENOTCONN; err = -ENOTCONN;
......
...@@ -58,7 +58,7 @@ void pppox_unbind_sock(struct sock *sk) ...@@ -58,7 +58,7 @@ void pppox_unbind_sock(struct sock *sk)
{ {
/* Clear connection to ppp device, if attached. */ /* Clear connection to ppp device, if attached. */
if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED | PPPOX_ZOMBIE)) { if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED)) {
ppp_unregister_channel(&pppox_sk(sk)->chan); ppp_unregister_channel(&pppox_sk(sk)->chan);
sk->sk_state = PPPOX_DEAD; sk->sk_state = PPPOX_DEAD;
} }
......
...@@ -91,7 +91,6 @@ enum { ...@@ -91,7 +91,6 @@ enum {
PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */ PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */
PPPOX_BOUND = 2, /* bound to ppp device */ PPPOX_BOUND = 2, /* bound to ppp device */
PPPOX_RELAY = 4, /* forwarding is enabled */ PPPOX_RELAY = 4, /* forwarding is enabled */
PPPOX_ZOMBIE = 8, /* dead, but still bound to ppp device */
PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment