1 Star 0 Fork 121

luofeng14/src-openEuler

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virtio-net-bugfix-do-not-delete-netdev-before-virtio.patch 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
From 532566ba64b60f2dd2f8ff41d670712ccafe1e98 Mon Sep 17 00:00:00 2001
From: Jinhua Cao <caojinhua1@huawei.com>
Date: Thu, 10 Feb 2022 10:31:38 +0800
Subject: [PATCH] virtio-net: bugfix: do not delete netdev before virtio net
For the vhost-user net-card, it is allow to delete its
network backend while the virtio-net device still exists.
However, when the status of the device changes in guest,
QEMU will check whether the network backend exists, otherwise
it will crash.
So do not allowed to delete the network backend directly
without delete virtio-net device.
Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
---
net/net.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/net.c b/net/net.c
index f0d14dbfc1..ed4b1c1740 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1202,6 +1202,12 @@ void qmp_netdev_del(const char *id, Error **errp)
return;
}
+ if (nc->info->type == NET_CLIENT_DRIVER_VHOST_USER && nc->peer) {
+ error_setg(errp, "Device '%s' is a netdev for vhostuser,"
+ "please delete the peer front-end device (virtio-net) first.", id);
+ return;
+ }
+
qemu_del_net_client(nc);
/*
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/luofeng14/qemu2.git
git@gitee.com:luofeng14/qemu2.git
luofeng14
qemu2
src-openEuler
master

搜索帮助