Re: [PATCH 1/4] vsock/virtio: fix locking around 'the_virtio_vsock'

2019-05-30 Thread Stefano Garzarella
On Wed, May 29, 2019 at 09:28:52PM -0700, David Miller wrote: > From: Stefano Garzarella > Date: Tue, 28 May 2019 12:56:20 +0200 > > > @@ -68,7 +68,13 @@ struct virtio_vsock { > > > > static struct virtio_vsock *virtio_vsock_get(void) > > { > > - return the_virtio_vsock; > > + struct virt

Re: [PATCH 1/4] vsock/virtio: fix locking around 'the_virtio_vsock'

2019-05-29 Thread David Miller
From: Stefano Garzarella Date: Tue, 28 May 2019 12:56:20 +0200 > @@ -68,7 +68,13 @@ struct virtio_vsock { > > static struct virtio_vsock *virtio_vsock_get(void) > { > - return the_virtio_vsock; > + struct virtio_vsock *vsock; > + > + mutex_lock(&the_virtio_vsock_mutex); > + vs

[PATCH 1/4] vsock/virtio: fix locking around 'the_virtio_vsock'

2019-05-28 Thread Stefano Garzarella
This patch protects the reading of 'the_virtio_vsock' taking the mutex used when it is set. We also move the 'the_virtio_vsock' assignment at the end of the .probe(), when we finished all the initialization, and at the beginning of .remove(), before to release resources, taking the lock until the e