summaryrefslogtreecommitdiff
path: root/drivers/net/ppp/pppoe.c
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2015-10-22 17:57:10 +0300
committerDavid S. Miller <davem@davemloft.net>2015-10-23 13:30:01 +0300
commit1acea4f6ce1b1c0941438aca75dd2e5c6b09db60 (patch)
tree095cebc2ead8abbaa4165a650b5997da39911285 /drivers/net/ppp/pppoe.c
parentf6b8dec99865ea906150e963eacbfd037b579ee9 (diff)
downloadlinux-1acea4f6ce1b1c0941438aca75dd2e5c6b09db60.tar.xz
ppp: fix pppoe_dev deletion condition in pppoe_release()
We can't rely on PPPOX_ZOMBIE to decide whether to clear po->pppoe_dev. PPPOX_ZOMBIE can be set by pppoe_disc_rcv() even when po->pppoe_dev is NULL. So we have no guarantee that (sk->sk_state & PPPOX_ZOMBIE) implies (po->pppoe_dev != NULL). Since we're releasing a PPPoE socket, we want to release the pppoe_dev if it exists and reset sk_state to PPPOX_DEAD, no matter the previous value of sk_state. So we can just check for po->pppoe_dev and avoid any assumption on sk->sk_state. Fixes: 2b018d57ff18 ("pppoe: drop PPPOX_ZOMBIEs in pppoe_release") Signed-off-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp/pppoe.c')
-rw-r--r--drivers/net/ppp/pppoe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 2ed75060da50..5e0b43283bce 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -589,7 +589,7 @@ static int pppoe_release(struct socket *sock)
po = pppox_sk(sk);
- if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) {
+ if (po->pppoe_dev) {
dev_put(po->pppoe_dev);
po->pppoe_dev = NULL;
}