From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umsqr-0005Uq-Pf for qemu-devel@nongnu.org; Wed, 12 Jun 2013 17:45:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umsqq-0000uU-RQ for qemu-devel@nongnu.org; Wed, 12 Jun 2013 17:45:09 -0400 Sender: fluxion From: Michael Roth Date: Wed, 12 Jun 2013 16:41:13 -0500 Message-Id: <1371073298-14519-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1371073298-14519-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1371073298-14519-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 01/26] 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: qemu-stable@nongnu.org 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. Reported-by: Michael Tokarev Acked-by: Michael Tokarev Reviewed-by: Stefan Hajnoczi Signed-off-by: Aneesh Kumar K.V (cherry picked from commit c7e587b73ebac05943df78f5f37d80d32ff47d3d) Signed-off-by: Michael Roth --- 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.7.9.5