Skip to contentSkip to conversation

hw/9pfs: Fix segfault with 9p2000.u

PATCH In review Aneesh Kumar K.V 3 participants 3 messages May 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/9pfs: Fix segfault with 9p2000.u

From: "Aneesh Kumar K.V" <[email protected]>

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.

---
 hw/9pfs/virtio-9p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/virtio-9p.c +1 -1
index 296f66f..8cbb8ae 100644
@@ -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;
Signature · 1 line
1.8.1.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <[email protected]>

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.

Quoted 4 lines
---
 hw/9pfs/virtio-9p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
Quoted 10 lines · Stefan Hajnoczi
Quoted 8 lines · Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines
---
 hw/9pfs/virtio-9p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Please also add

/mjt