diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2019-11-03 07:11:11 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-06 02:55:47 +0100 |
commit | 3b7ad08b5153b0eda2f4d57ac53d815c30acd172 (patch) | |
tree | 1bcc99705b63930edf6053da1d0a3142b941c4a2 /net/vmw_vsock/af_vsock.c | |
parent | net: dsa: Fix use after free in dsa_switch_remove() (diff) | |
download | linux-3b7ad08b5153b0eda2f4d57ac53d815c30acd172.tar.xz linux-3b7ad08b5153b0eda2f4d57ac53d815c30acd172.zip |
vsock: Simplify '__vsock_release()'
Use 'skb_queue_purge()' instead of re-implementing it.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/vmw_vsock/af_vsock.c')
-rw-r--r-- | net/vmw_vsock/af_vsock.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 582a3e4dfce2..c0856e74f44f 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -641,7 +641,6 @@ EXPORT_SYMBOL_GPL(__vsock_create); static void __vsock_release(struct sock *sk, int level) { if (sk) { - struct sk_buff *skb; struct sock *pending; struct vsock_sock *vsk; @@ -662,8 +661,7 @@ static void __vsock_release(struct sock *sk, int level) sock_orphan(sk); sk->sk_shutdown = SHUTDOWN_MASK; - while ((skb = skb_dequeue(&sk->sk_receive_queue))) - kfree_skb(skb); + skb_queue_purge(&sk->sk_receive_queue); /* Clean up any sockets that never were accepted. */ while ((pending = vsock_dequeue_accept(sk)) != NULL) { |