Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pppoe: drop pppoe device in pppoe_unbind_sock_work

After receiving a PADT and the socket is closed, user space will no
longer drop the reference to the pppoe device.
This leads to errors like this:

[ 488.570000] unregister_netdevice: waiting for eth0.2 to become free. Usage count = 2

Fixes: 287f3a943fe ("pppoe: Use workqueue to die properly when a PADT is received")
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Felix Fietkau and committed by
David S. Miller
665a6cd8 268be0f7

+4
+4
drivers/net/ppp/pppoe.c
··· 465 465 struct sock *sk = sk_pppox(po); 466 466 467 467 lock_sock(sk); 468 + if (po->pppoe_dev) { 469 + dev_put(po->pppoe_dev); 470 + po->pppoe_dev = NULL; 471 + } 468 472 pppox_unbind_sock(sk); 469 473 release_sock(sk); 470 474 sock_put(sk);