Skip to content

Commit

Permalink
vhost: fix lock on device readiness notification
Browse files Browse the repository at this point in the history
[ upstream commit 7f31d4e ]

The vhost notifies the application of device readiness via
vhost_user_notify_queue_state(), but calling this function
is not protected by the lock. This patch is to make this
function call lock protected.

Fixes: d0fcc38 ("vhost: improve device readiness notifications")

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
humasama authored and bluca committed Jul 26, 2021
1 parent 12e277d commit e1b663f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/librte_vhost/vhost_user.c
Expand Up @@ -2892,9 +2892,6 @@ vhost_user_msg_handler(int vid, int fd)
}
}

if (unlock_required)
vhost_user_unlock_all_queue_pairs(dev);

/* If message was not handled at this stage, treat it as an error */
if (!handled) {
VHOST_LOG_CONFIG(ERR,
Expand Down Expand Up @@ -2929,6 +2926,8 @@ vhost_user_msg_handler(int vid, int fd)
}
}

if (unlock_required)
vhost_user_unlock_all_queue_pairs(dev);

if (!virtio_is_ready(dev))
goto out;
Expand Down

0 comments on commit e1b663f

Please sign in to comment.