Re: [PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc

2019-06-03 Thread Stefano Garzarella
On Sun, Jun 02, 2019 at 06:03:34PM -0700, David Miller wrote: > From: Stefano Garzarella > Date: Fri, 31 May 2019 15:39:51 +0200 > > > @@ -434,7 +434,9 @@ void virtio_transport_set_buffer_size(struct vsock_sock > > *vsk, u64 val) > > if (val > vvs->buf_size_max) > > vvs->buf_size

Re: [PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc

2019-06-02 Thread David Miller
From: Stefano Garzarella Date: Fri, 31 May 2019 15:39:51 +0200 > @@ -434,7 +434,9 @@ void virtio_transport_set_buffer_size(struct vsock_sock > *vsk, u64 val) > if (val > vvs->buf_size_max) > vvs->buf_size_max = val; > vvs->buf_size = val; > + spin_lock_bh(&vvs->rx_l

[PATCH v3 2/5] vsock/virtio: fix locking for fwd_cnt and buf_alloc

2019-05-31 Thread Stefano Garzarella
fwd_cnt is written with rx_lock, so we should read it using the same spinlock also if we are in the TX path. Move also buf_alloc under rx_lock and add a missing locking when we modify it. Signed-off-by: Stefano Garzarella --- include/linux/virtio_vsock.h| 2 +- net/vmw_vsock/virtio_