From nobody Mon Feb 9 12:57:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513356240529917.2956815593813; Fri, 15 Dec 2017 08:44:00 -0800 (PST) Received: from localhost ([::1]:47568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePt5T-0000HP-V0 for importer@patchew.org; Fri, 15 Dec 2017 11:43:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePt46-0007ot-U8 for qemu-devel@nongnu.org; Fri, 15 Dec 2017 11:42:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePt42-0005tx-V3 for qemu-devel@nongnu.org; Fri, 15 Dec 2017 11:42:26 -0500 Received: from 12.mo1.mail-out.ovh.net ([87.98.162.229]:38885) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ePt42-0005ez-OQ for qemu-devel@nongnu.org; Fri, 15 Dec 2017 11:42:22 -0500 Received: from player730.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 02A54B0982 for ; Fri, 15 Dec 2017 17:42:11 +0100 (CET) Received: from [192.168.0.243] (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player730.ha.ovh.net (Postfix) with ESMTPA id 0519C440093; Fri, 15 Dec 2017 17:42:08 +0100 (CET) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 15 Dec 2017 17:42:02 +0100 Message-ID: <151335612254.14991.13093029894103210710.stgit@bahia> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 18114040651708864832 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtuddrfeeggdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecu X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 87.98.162.229 Subject: [Qemu-devel] [PATCH] 9pfs: fix error path in pdu_submit() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 If we receive an unsupported request id, we first decide to return -ENOTSUPP to the client, but since the request id causes is_read_only_op() to return false, we change the error to be -EROFS if the fsdev is read-only. This doesn't make sense since we don't know what the client asked for. This patch ensures that -EROFS can only be returned if the request id is supported. Signed-off-by: Greg Kurz Reviewed-by: Eric Blake --- hw/9pfs/9p.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 76f90f2b7863..558efb41defd 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3473,14 +3473,12 @@ void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr) if (pdu->id >=3D ARRAY_SIZE(pdu_co_handlers) || (pdu_co_handlers[pdu->id] =3D=3D NULL)) { handler =3D v9fs_op_not_supp; + } else if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) { + handler =3D v9fs_fs_ro; } else { handler =3D pdu_co_handlers[pdu->id]; } =20 - if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) { - handler =3D v9fs_fs_ro; - } - qemu_co_queue_init(&pdu->complete); co =3D qemu_coroutine_create(handler, pdu); qemu_coroutine_enter(co);