]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/9pfs: Fix segfault with 9p2000.u
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 20 May 2013 06:05:00 +0000 (11:35 +0530)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 20 May 2013 16:25:00 +0000 (11:25 -0500)
When guest tries to chmod a block or char device file over 9pfs,
the qemu process segfaults. With 9p2000.u protocol we use wstat to
change mode bits and client don't send extension information for
chmod. We need to check for size field to check whether extension
info is present or not.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/9pfs/virtio-9p.c

index d3ea820eae46ac9c1069a8687717f5d38ab1e976..52d9b8cc89e7f6f076eb3917aaf19b2814c5e1b3 100644 (file)
@@ -659,7 +659,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
         ret |= S_IFIFO;
     }
     if (mode & P9_STAT_MODE_DEVICE) {
-        if (extension && extension->data[0] == 'c') {
+        if (extension->size && extension->data[0] == 'c') {
             ret |= S_IFCHR;
         } else {
             ret |= S_IFBLK;