virtio/vsock: rework MSG_PEEK for SOCK_STREAM
authorArseniy Krasnov <AVKrasnov@sberdevices.ru>
Tue, 25 Jul 2023 17:29:09 +0000 (20:29 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 27 Jul 2023 13:51:48 +0000 (15:51 +0200)
commit051e77e33946f932e6879bf4df2773e3c998c3a7
treefc1b227d5947fd17355bf40a5b77bd68786a973d
parentbc758ade614576d1c1b167af0246ada8c916c804
virtio/vsock: rework MSG_PEEK for SOCK_STREAM

This reworks current implementation of MSG_PEEK logic:
1) Replaces 'skb_queue_walk_safe()' with 'skb_queue_walk()'. There is
   no need in the first one, as there are no removes of skb in loop.
2) Removes nested while loop - MSG_PEEK logic could be implemented
   without it: just iterate over skbs without removing it and copy
   data from each until destination buffer is not full.

Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Reviewed-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/vmw_vsock/virtio_transport_common.c