qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH -V2 06/13] hw/9pfs: Ensure an error is reported to user if 9pfs mount tag is too long
Date: Tue, 11 Oct 2011 16:11:38 +0530	[thread overview]
Message-ID: <1318329705-3179-7-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1318329705-3179-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

From: "Daniel P. Berrange" <berrange@redhat.com>

If the 9pfs mount tag is longer than MAX_TAG_LEN bytes, rather than
silently truncating the tag which will likely break the guest OS,
report an immediate error and exit QEMU

* hw/9pfs/virtio-9p-device.c: Report error & exit if mount tag is
  too long

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/9pfs/virtio-9p-device.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index b23e8a4..0930d22 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -119,7 +119,9 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
     s->ctx.fs_root = g_strdup(fse->path);
     len = strlen(conf->tag);
     if (len > MAX_TAG_LEN) {
-        len = MAX_TAG_LEN;
+        fprintf(stderr, "mount tag '%s' (%d bytes) is longer than "
+                "maximum (%d bytes)", conf->tag, len, MAX_TAG_LEN);
+        exit(1);
     }
     /* s->tag is non-NULL terminated string */
     s->tag = g_malloc(len);
-- 
1.7.5.4

  parent reply	other threads:[~2011-10-11 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 10:41 [Qemu-devel] [PATCH V2 00/13] VirtFS update Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 01/13] hw/9pfs: Use ioeventfd for 9p Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 02/13] hw/9pfs: Add new virtfs option cache=writethrough to skip host page cache Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 03/13] qemu-options.hx: Update virtfs command documentation Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 04/13] hw/9pfs: Fix build error on platform that don't support futimens Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 05/13] virtio-9p: Use 9P specific Lock constants Aneesh Kumar K.V
2011-10-11 10:41 ` Aneesh Kumar K.V [this message]
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 07/13] hw/9pfs: Add open flag mapping Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 08/13] hw/9pfs: Add st_gen support in getattr reply Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 09/13] hw/9pfs: Add st_gen support for handle based fs driver Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 10/13] hw/9pfs: Introduce tracing for 9p pdu handlers Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 11/13] hw/9pfs: Remove virtio-9p-debug.* infra to be replaced by Qemu Tracing Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 12/13] scripts: Simpletrace log analysis script for pretty-printing 9p log Aneesh Kumar K.V
2011-10-11 10:41 ` [Qemu-devel] [PATCH -V2 13/13] hw/9pfs: Use fs driver specific lstat Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318329705-3179-7-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).