mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
virtio/vsock: WARN_ONCE() for invalid state of socket
This adds WARN_ONCE() and return from stream dequeue callback when socket's queue is empty, but 'rx_bytes' still non-zero. This allows the detection of potential bugs due to packet merging (see previous patch). Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
f7154d967b
commit
b8d2f61fdf
1 changed files with 7 additions and 0 deletions
|
@ -363,6 +363,13 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
|
|||
u32 free_space;
|
||||
|
||||
spin_lock_bh(&vvs->rx_lock);
|
||||
|
||||
if (WARN_ONCE(skb_queue_empty(&vvs->rx_queue) && vvs->rx_bytes,
|
||||
"rx_queue is empty, but rx_bytes is non-zero\n")) {
|
||||
spin_unlock_bh(&vvs->rx_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
while (total < len && !skb_queue_empty(&vvs->rx_queue)) {
|
||||
skb = skb_peek(&vvs->rx_queue);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue