[PATCH] vhost/crypto: fix locking

Maxime Coquelin maxime.coquelin at redhat.com
Wed Mar 5 10:52:37 CET 2025



On 3/5/25 10:12 AM, David Marchand wrote:
> vc_req_out->vq->iotlb_lock is taken twice on the same thread:
> vc_req_out->vq refers to vc_req->vq (after a memcpy), which itself
> is a reference to the vq.
> 
> clang probably does not detect that the same object is already locked as
> it does not track object referencies.

s/referencies/references/

> 
> Finish the incomplete and incorrect cleanup and only refer to the
> &vq->iotlb_lock capability (required by vhost_iova_to_vva).
> 
> Fixes: 88c73b5434e6 ("vhost/crypto: fix thread safety check")
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
>   lib/vhost/vhost_crypto.c | 95 +++++++++++++++++++---------------------
>   1 file changed, 46 insertions(+), 49 deletions(-)
> 


Thanks for fixing this!
With the typo fixed:

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Maxime



More information about the dev mailing list