From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmOUo-0007MY-I9 for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:06:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmOUk-0007OZ-4m for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:06:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47567 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmOUj-0007OK-VT for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:06:10 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8KH3K8t004672 for ; Tue, 20 Sep 2016 13:06:09 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 25jkn528xe-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 20 Sep 2016 13:06:09 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Sep 2016 11:06:08 -0600 From: Michael Roth Date: Tue, 20 Sep 2016 12:05:30 -0500 In-Reply-To: <1474391141-16623-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1474391141-16623-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Message-Id: <1474391141-16623-15-git-send-email-mdroth@linux.vnet.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 14/25] 9pfs: fix potential segfault during walk List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Greg Kurz From: Greg Kurz If the call to fid_to_qid() returns an error, we will call v9fs_path_free= () on uninitialized paths. It is a regression introduced by the following commit: 56f101ecce0e 9pfs: handle walk of ".." in the root directory Let's fix this by initializing dpath and path before calling fid_to_qid(). Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater [groug: updated the changelog to indicate this is regression and to provi= de the offending commit SHA1] Signed-off-by: Greg Kurz (cherry picked from commit 13fd08e631ec0c3ff5ad1bdcb6a4474c7d9a024f) Signed-off-by: Michael Roth --- hw/9pfs/9p.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 1ac05b2..d47f5de 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1318,13 +1318,14 @@ static void v9fs_walk(void *opaque) goto out_nofid; } =20 + v9fs_path_init(&dpath); + v9fs_path_init(&path); + err =3D fid_to_qid(pdu, fidp, &qid); if (err < 0) { goto out; } =20 - v9fs_path_init(&dpath); - v9fs_path_init(&path); /* * Both dpath and path initially poin to fidp. * Needed to handle request with nwnames =3D=3D 0 --=20 1.9.1