vhost: fix virtqueue access lock check for handlers
PATCH 1/1 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
--- lib/vhost/vhost_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/vhost/vhost_user.c +1 -1
@@ -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 ;
Signature · 1 line
2.44.0
Quoted 17 lines · David Marchand
As the vhost library may receive a request for an unsupported request, it is necessary to check
msg_handlerbefore checking if locking queue pairs is requested.Coverity issue: 415049
Fixes 5e8fcc60b59d ("vhost: enhance virtqueue access lock asserts")Signed-off-by David Marchand <[email protected]>--- lib/vhost/vhost_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/vhost/vhost_user.c +0
-0
lib/vhost/vhost_user.c vhost_user_msg_handler(int vid, int fd) · line 3177
Quoted 8 lines
lib/vhost/vhost_user.c +1
-1@@ -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 ;
Quoted 17 lines · David Marchand
As the vhost library may receive a request for an unsupported request, it is necessary to check
msg_handlerbefore checking if locking queue pairs is requested.Coverity issue: 415049
Fixes 5e8fcc60b59d ("vhost: enhance virtqueue access lock asserts")Signed-off-by David Marchand <[email protected]>--- lib/vhost/vhost_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/vhost/vhost_user.c +0
-0
lib/vhost/vhost_user.c vhost_user_msg_handler(int vid, int fd) · line 3177
Quoted 8 lines
lib/vhost/vhost_user.c +1
-1@@ -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 ;
Thanks,
Maxime
David Marchand
AppliedQuoted 9 lines · David Marchand
As the vhost library may receive a request for an unsupported request, it is necessary to check
msg_handlerbefore checking if locking queue pairs is requested.Coverity issue: 415049
Fixes 5e8fcc60b59d ("vhost: enhance virtqueue access lock asserts")Signed-off-by David Marchand <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand