Skip to content

Commit

Permalink
vhost: fix lock on device readiness notification
Browse files Browse the repository at this point in the history
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")
Cc: stable@dpdk.org

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
humasama authored and chenbo-xia committed Jul 21, 2021
1 parent 92ed77d commit 7f31d4e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/vhost/vhost_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2995,9 +2995,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 @@ -3032,6 +3029,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 7f31d4e

Please sign in to comment.