Received: from eggs.gnu.org ([208.118.235.92]:47466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeJDg-0000KI-1A for qemu-devel@nongnu.org; Mon, 20 May 2013 02:05:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeJDf-000341-59 for qemu-devel@nongnu.org; Mon, 20 May 2013 02:05:15 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:50872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeJDe-00033h-Gk for qemu-devel@nongnu.org; Mon, 20 May 2013 02:05:15 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 20 May 2013 11:30:09 +0530 From: "Aneesh Kumar K.V" Date: Mon, 20 May 2013 11:35:00 +0530 Message-Id: <1369029900-9057-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] hw/9pfs: Fix segfault with 9p2000.u List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, qemu-stable@nongnu.org, "Aneesh Kumar K.V" From: "Aneesh Kumar K.V" 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 --- 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 *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; -- 1.8.1.2