[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] vhost-user-blk: check connection state in vhost_user_blk_set
|
From: |
Konstantin Khlebnikov |
|
Subject: |
[PATCH 2/2] vhost-user-blk: check connection state in vhost_user_blk_set_config |
|
Date: |
Thu, 10 Feb 2022 14:46:18 +0300 |
|
User-agent: |
StGit/1.4.dev11+gd5bef96 |
Fuzzing found that ->set_config() could be called without connection.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
hw/block/vhost-user-blk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 35ac188ca4..9ac50443bc 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -72,6 +72,10 @@ static void vhost_user_blk_set_config(VirtIODevice *vdev,
const uint8_t *config)
struct virtio_blk_config *blkcfg = (struct virtio_blk_config *)config;
int ret;
+ if (!s->connected) {
+ return;
+ }
+
if (blkcfg->wce == s->blkcfg.wce) {
return;
}