[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-stable] [PATCH 01/26] hw/9pfs: Fix segfault with 9p2000.u

From: Michael Roth
Subject: [Qemu-stable] [PATCH 01/26] hw/9pfs: Fix segfault with 9p2000.u
Date: Wed, 12 Jun 2013 16:41:13 -0500

From: "Aneesh Kumar K.V" <address@hidden>

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 <address@hidden>
Acked-by: Michael Tokarev <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Aneesh Kumar K.V <address@hidden>
(cherry picked from commit c7e587b73ebac05943df78f5f37d80d32ff47d3d)

Signed-off-by: Michael Roth <address@hidden>
 hw/9pfs/virtio-9p.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 296f66f..8cbb8ae 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 
         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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]