qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] 9pfs: fix error path in pdu_submit()
@ 2017-12-15 16:42 Greg Kurz
  2017-12-20 19:04 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2017-12-15 16:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Greg Kurz

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 <groug@kaod.org>
---
 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 >= ARRAY_SIZE(pdu_co_handlers) ||
         (pdu_co_handlers[pdu->id] == NULL)) {
         handler = v9fs_op_not_supp;
+    } else if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) {
+        handler = v9fs_fs_ro;
     } else {
         handler = pdu_co_handlers[pdu->id];
     }
 
-    if (is_ro_export(&s->ctx) && !is_read_only_op(pdu)) {
-        handler = v9fs_fs_ro;
-    }
-
     qemu_co_queue_init(&pdu->complete);
     co = qemu_coroutine_create(handler, pdu);
     qemu_coroutine_enter(co);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] 9pfs: fix error path in pdu_submit()
  2017-12-15 16:42 [Qemu-devel] [PATCH] 9pfs: fix error path in pdu_submit() Greg Kurz
@ 2017-12-20 19:04 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2017-12-20 19:04 UTC (permalink / raw)
  To: Greg Kurz, qemu-devel

On 12/15/2017 10:42 AM, Greg Kurz wrote:
> 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 <groug@kaod.org>
> ---
>   hw/9pfs/9p.c |    6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-20 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-15 16:42 [Qemu-devel] [PATCH] 9pfs: fix error path in pdu_submit() Greg Kurz
2017-12-20 19:04 ` Eric Blake

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).