From: Johannes Berg <johannes@sipsolutions.net>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Johannes Berg" <johannes.berg@intel.com>,
"Tiwei Bie" <tiwei.bie@intel.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v2] libvhost-user: fix SLAVE_SEND_FD handling
Date: Tue, 3 Sep 2019 23:04:22 +0300 [thread overview]
Message-ID: <20190903200422.11693-1-johannes@sipsolutions.net> (raw)
From: Johannes Berg <johannes.berg@intel.com>
It doesn't look like this could possibly work properly since
VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD is defined to 10, but the
dev->protocol_features has a bitmap. I suppose the peer this
was tested with also supported VHOST_USER_PROTOCOL_F_LOG_SHMFD,
in which case the test would always be false, but nevertheless
the code seems wrong.
Use has_feature() to fix this.
Fixes: d84599f56c82 ("libvhost-user: support host notifier")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
contrib/libvhost-user/libvhost-user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 6a02eaffc672..fcf4a8a00ed2 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -1097,7 +1097,8 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd,
vmsg.fd_num = fd_num;
- if ((dev->protocol_features & VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) == 0) {
+ if (!has_feature(dev->protocol_features,
+ VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) {
return false;
}
--
2.23.0
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Johannes Berg" <johannes.berg@intel.com>,
"Tiwei Bie" <tiwei.bie@intel.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Xie Yongji" <xieyongji@baidu.com>
Subject: [Qemu-devel] [PULL 5/6] libvhost-user: fix SLAVE_SEND_FD handling
Date: Wed, 4 Sep 2019 08:01:08 -0400 [thread overview]
Message-ID: <20190903200422.11693-1-johannes@sipsolutions.net> (raw)
Message-ID: <20190904120108.5NmtJRv3jeC5OlCk1BO1wXVMbJ8Q0TuQaJQI4EILkqY@z> (raw)
In-Reply-To: <20190904120026.3220-1-mst@redhat.com>
From: Johannes Berg <johannes.berg@intel.com>
It doesn't look like this could possibly work properly since
VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD is defined to 10, but the
dev->protocol_features has a bitmap. I suppose the peer this
was tested with also supported VHOST_USER_PROTOCOL_F_LOG_SHMFD,
in which case the test would always be false, but nevertheless
the code seems wrong.
Use has_feature() to fix this.
Fixes: d84599f56c82 ("libvhost-user: support host notifier")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Message-Id: <20190903200422.11693-1-johannes@sipsolutions.net>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
contrib/libvhost-user/libvhost-user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 4b36e35a82..cb5f5770e4 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -1097,7 +1097,8 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd,
vmsg.fd_num = fd_num;
- if ((dev->protocol_features & VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) == 0) {
+ if (!has_feature(dev->protocol_features,
+ VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) {
return false;
}
--
MST
next prev reply other threads:[~2019-09-03 20:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 12:00 [Qemu-devel] [PULL 0/6] virtio,vhost: fixes, features, cleanups Michael S. Tsirkin
2019-08-20 16:30 ` [Qemu-devel] [PATCH v2] virtio-pci: Add Function Level Reset support Julia Suvorova
2019-09-04 12:01 ` [Qemu-devel] [PULL 4/6] " Michael S. Tsirkin
2019-09-03 20:04 ` Johannes Berg [this message]
2019-09-04 2:06 ` [Qemu-devel] [PATCH v2] libvhost-user: fix SLAVE_SEND_FD handling Tiwei Bie
2019-09-04 9:01 ` Tiwei Bie
2019-09-04 12:01 ` [Qemu-devel] [PULL 5/6] " Michael S. Tsirkin
2019-09-04 6:50 ` [Qemu-devel] [PATCH] libvhost-user: introduce and use vu_has_protocol_feature() Johannes Berg
2019-09-04 9:22 ` Tiwei Bie
2019-09-04 12:01 ` [Qemu-devel] [PULL 6/6] " Michael S. Tsirkin
2019-09-04 17:16 ` [Qemu-devel] [PULL 0/6] virtio, vhost: fixes, features, cleanups Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2019-08-20 16:06 [Qemu-devel] [PATCH v8 0/3] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Laurent Vivier
2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 1/3] " Laurent Vivier
2019-09-04 12:00 ` [Qemu-devel] [PULL 1/6] " Michael S. Tsirkin
2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 2/3] virtio-rng: Keep the default backend out of VirtIORNGConf Laurent Vivier
2019-09-04 12:00 ` [Qemu-devel] [PULL 2/6] " Michael S. Tsirkin
2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 3/3] virtio-rng: change default backend to rng-builtin Laurent Vivier
2019-09-04 12:00 ` [Qemu-devel] [PULL 3/6] " Michael S. Tsirkin
2019-09-04 10:26 ` [Qemu-devel] [PATCH v8 0/3] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190903200422.11693-1-johannes@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=johannes.berg@intel.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tiwei.bie@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).