Skip to content

Commit 47358f8

Browse files
vhost: fix virtqueue access lock check for handlers
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: 5e8fcc6 ("vhost: enhance virtqueue access lock asserts") Signed-off-by: David Marchand <[email protected]> Acked-by: Kevin Traynor <[email protected]> Reviewed-by: Maxime Coquelin <[email protected]>
1 parent 3bb7df6 commit 47358f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/vhost/vhost_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3171,7 +3171,7 @@ vhost_user_msg_handler(int vid, int fd)
31713171
* inactive, so it is safe. Otherwise taking the access_lock
31723172
* would cause a dead lock.
31733173
*/
3174-
if (msg_handler->lock_all_qps) {
3174+
if (msg_handler != NULL && msg_handler->lock_all_qps) {
31753175
if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {
31763176
vhost_user_lock_all_queue_pairs(dev);
31773177
unlock_required = 1;

0 commit comments

Comments
 (0)