From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9I91-00009e-FW for qemu-devel@nongnu.org; Thu, 29 Sep 2011 11:03:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9I8v-0004cL-06 for qemu-devel@nongnu.org; Thu, 29 Sep 2011 11:03:27 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:38183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9I8u-0004c6-R6 for qemu-devel@nongnu.org; Thu, 29 Sep 2011 11:03:20 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p8TEgHLI006338 for ; Thu, 29 Sep 2011 08:42:17 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8TF3CYJ134630 for ; Thu, 29 Sep 2011 09:03:13 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8TF38cg023295 for ; Thu, 29 Sep 2011 09:03:10 -0600 From: "Aneesh Kumar K.V" In-Reply-To: <1317292424-12239-1-git-send-email-berrange@redhat.com> References: <1317292424-12239-1-git-send-email-berrange@redhat.com> Date: Thu, 29 Sep 2011 20:32:54 +0530 Message-ID: <87mxdnqtlt.fsf@skywalker.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] Ensure an error is reported to user if 9pfs mount tag is too long List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Harsh Bora On Thu, 29 Sep 2011 11:33:44 +0100, "Daniel P. Berrange" wrote: > From: "Daniel P. Berrange" > > 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 Applied to the VirtFS (git://repo.or.cz/qemu/v9fs.git). I have to apply by hand, because it didn't apply cleanly. I also fixed checkpatch.pl errors. > --- > 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 97f2da5..8ca38d3 100644 > --- a/hw/9pfs/virtio-9p-device.c > +++ b/hw/9pfs/virtio-9p-device.c > @@ -117,7 +117,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.6.2 > > -aneesh