diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-05-20 11:29:52 +0530 |
---|---|---|
committer | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-05-28 15:23:12 +0530 |
commit | c7e587b73ebac05943df78f5f37d80d32ff47d3d (patch) | |
tree | 61f29fd89a642551b6ffb6a8d75dbab63ff725de | |
parent | 371386fb60961e0afc02f03c817dff79633e323e (diff) | |
download | qemu-c7e587b73ebac05943df78f5f37d80d32ff47d3d.tar.gz qemu-c7e587b73ebac05943df78f5f37d80d32ff47d3d.tar.bz2 qemu-c7e587b73ebac05943df78f5f37d80d32ff47d3d.zip |
hw/9pfs: Fix segfault with 9p2000.u
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.
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-rw-r--r-- | hw/9pfs/virtio-9p.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index 296f66f293..8cbb8ae32a 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -658,7 +658,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; |