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=1567541297; cv=none; d=zoho.com; s=zohoarc; b=C0H7D/1k9M/we8vtietuws30vw5ZrF03BskojL3E+tipigQ9n5UzIu9L7Kf3ZqaPaak9tNci4McpiPJBNa/bdxhHq8kP2cLoH4ZPtoF7i0iCuwdYlnVBi4QDy9zQs9WgrDRkTxS2xux7KHo7g5qgJ9m+y3T/QHsF8O+rRJQe7R8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567541297; 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=L3anOmnfF9q/x/NLguQYmoe7BStjl+U0CiclGf6YZzE=; b=jHWzWk6+xTTA1hcuWn03Pv0ai8y5aHxhwr/DYDtEPk8Ri8/jMGRg0kl/RPruM759usxneUsvaJiht/Guc1Gdi2sNpfG4bVq0kQzUdnaMZMjblG3G5xHNyILNWryJz4G7hAE5g6fK/c7fvWOrGR4ERlZx+N7NcMO4lTWIGdi15EQ= 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 1567541297392187.7193540229838; Tue, 3 Sep 2019 13:08:17 -0700 (PDT) Received: from localhost ([::1]:50496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5F67-00061s-Vg for importer@patchew.org; Tue, 03 Sep 2019 16:08:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46176) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5F2U-0002Wc-Mk for qemu-devel@nongnu.org; Tue, 03 Sep 2019 16:04:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5F2T-00049J-Hy for qemu-devel@nongnu.org; Tue, 03 Sep 2019 16:04:30 -0400 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2]:37076 helo=sipsolutions.net) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5F2T-000484-Ao for qemu-devel@nongnu.org; Tue, 03 Sep 2019 16:04:29 -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 1i5F2P-0008HB-VJ; Tue, 03 Sep 2019 22:04:26 +0200 From: Johannes Berg To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 23:04:22 +0300 Message-Id: <20190903200422.11693-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 v2] 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 Reviewed-by: Tiwei Bie --- 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, =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