[PATCH] vhost: fix read vs write lock mismatch

Maxime Coquelin maxime.coquelin at redhat.com
Tue Nov 26 09:14:44 CET 2024



On 11/18/24 17:24, Stephen Hemminger wrote:
> If lock is acquired for write, it must be released for write
> or a deadlock is likely.
> 
> Bugzilla ID: 1582
> Fixes: 9fc93a1e2320 ("vhost: fix virtqueue access check in datapath")
> Cc: david.marchand at redhat.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>   lib/vhost/virtio_net.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index 298a5dae74..d764d4bc6a 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -2538,7 +2538,7 @@ virtio_dev_rx_async_submit(struct virtio_net *dev, struct vhost_virtqueue *vq,
>   
>   	if (unlikely(!vq->access_ok)) {
>   		vhost_user_iotlb_rd_unlock(vq);
> -		rte_rwlock_read_unlock(&vq->access_lock);
> +		rte_rwlock_write_unlock(&vq->access_lock);
>   
>   		virtio_dev_vring_translate(dev, vq);
>   		goto out_no_unlock;

Applied to dpdk-next-virtio/for-main with suggested title change.

Thanks,
Maxime



More information about the stable mailing list