l2tp: purge socket queues in the .destruct() callback
commit5894337297adb61b8b90108a5be4cead6fe6a595
authorGuillaume Nault <g.nault@alphalink.fr>
Wed, 29 Mar 2017 06:45:29 +0000 (29 08:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 May 2017 15:37:39 +0000 (3 08:37 -0700)
treeddbbaaac3e505c083c71ce25da2ac952dccf83bb
parent7d5eb39c0d8cb1a8ddfc137dac2086692362a044
l2tp: purge socket queues in the .destruct() callback

[ Upstream commit e91793bb615cf6cdd59c0b6749fe173687bb0947 ]

The Rx path may grab the socket right before pppol2tp_release(), but
nothing guarantees that it will enqueue packets before
skb_queue_purge(). Therefore, the socket can be destroyed without its
queues fully purged.

Fix this by purging queues in pppol2tp_session_destruct() where we're
guaranteed nothing is still referencing the socket.

Fixes: 9e9cb6221aa7 ("l2tp: fix userspace reception on plain L2TP sockets")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/l2tp/l2tp_ppp.c