From nobody Wed Nov 12 01:54:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1567540545; cv=none; d=zoho.com; s=zohoarc; b=K+kQfeSyg8oZbaVhMLoc8twpnNdI3C+/0DJIza4oZwpc7no+cJq4o6iLy37Mq4/gzDVn/GoB6db+jFd6KnRN3sCrczt5eMuVLSHpUVIEru5UdkYaT3n3+NTB0Ys0bcpOHlIXPmXMsBk4XM00vgTzBT1pWn/V3tX206x3HDB0Exk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567540545; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=FXwF3uEzlvVISw+O0k1obG8SzcL/2AdSIOJcsC1rjDs=; b=JQ/0VdCrJjb3khSla15TWKdbpbRVOpBB5biXk1EOj5dyCg9hk4gff5c0w4U4SlS3/XhpqhHBno4oGX+OKLX4Gx0vWcmxmmt9y17h9+1YhO1lzFb0AONv/YHoHDxDQdny849QWyGSVmERqtEABLRRLaKRwF4h2vFwTumBvHWNhjY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567540545613560.1605389617181; Tue, 3 Sep 2019 12:55:45 -0700 (PDT) Received: from localhost ([::1]:50406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Eu0-0005wh-FG for importer@patchew.org; Tue, 03 Sep 2019 15:55:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44642) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5EtI-0005Ss-6V for qemu-devel@nongnu.org; Tue, 03 Sep 2019 15:55:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5EtH-0006M5-4e for qemu-devel@nongnu.org; Tue, 03 Sep 2019 15:54:59 -0400 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2]:36952 helo=sipsolutions.net) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5EtG-0006L1-V8 for qemu-devel@nongnu.org; Tue, 03 Sep 2019 15:54:59 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.1) (envelope-from ) id 1i5EtD-00085A-Js; Tue, 03 Sep 2019 21:54:55 +0200 From: Johannes Berg To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 22:54:42 +0300 Message-Id: <20190903195442.11199-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a01:4f8:191:4433::2 Subject: [Qemu-devel] [PATCH] libvhost-user: fix SLAVE_SEND_FD handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Johannes Berg , Tiwei Bie , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Johannes Berg 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 --- 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..e250e69abec9 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, =20 vmsg.fd_num =3D fd_num; =20 - if ((dev->protocol_features & VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) =3D= =3D 0) { + if (!has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) { return false; } =20 --=20 2.23.0