[PATCH] vhost: fix virtqueue access lock check for handlers
Maxime Coquelin
maxime.coquelin at redhat.com
Mon Mar 11 11:42:09 CET 2024
On 3/7/24 11:36, David Marchand wrote:
> As the vhost library may receive a request for an unsupported request,
> it is necessary to check msg_handler before checking if locking queue
> pairs is requested.
>
> Coverity issue: 415049
> Fixes: 5e8fcc60b59d ("vhost: enhance virtqueue access lock asserts")
>
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
> lib/vhost/vhost_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 7fe1687f08..414192500e 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -3171,7 +3171,7 @@ vhost_user_msg_handler(int vid, int fd)
> * inactive, so it is safe. Otherwise taking the access_lock
> * would cause a dead lock.
> */
> - if (msg_handler->lock_all_qps) {
> + if (msg_handler != NULL && msg_handler->lock_all_qps) {
> if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
> vhost_user_lock_all_queue_pairs(dev);
> unlock_required = 1;
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Thanks,
Maxime
More information about the dev
mailing list