Skip to content

Commit

Permalink
9pfs: fix error path in pdu_submit()
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
gkurz committed Jan 8, 2018
1 parent 7bd41d3 commit d147123
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions hw/9pfs/9p.c
Expand Up @@ -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);
Expand Down

0 comments on commit d147123

Please sign in to comment.