Patchwork [2/2] tap: properly initialize vhostfds

login
register
mail settings
Submitter Stefan Hajnoczi
Date May 3, 2013, 11:57 a.m.
Message ID <1367582254-15060-3-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/241288/
State New
Headers show

Comments

Stefan Hajnoczi - May 3, 2013, 11:57 a.m.
From: Jason Wang <jasowang@redhat.com>

Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were
forgot, this will lead qemu to ignore all fds passed by management through
vhostfds, and tries to create vhost_net device itself. Fix by adding this check
also.

Reportyed-by: Michal Privoznik <mprivozn@redhat.com>
Cc: Michal Privoznik <mprivozn@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 net/tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/net/tap.c b/net/tap.c
index 17bdf01..e0b7a2a 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -623,7 +623,7 @@  static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
         int vhostfd;
 
-        if (tap->has_vhostfd) {
+        if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_handle_fd_param(cur_mon, vhostfdname);
             if (vhostfd == -1) {
                 return -1;