From nobody Mon Nov 3 20:05:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505919125680432.9335658475994; Wed, 20 Sep 2017 07:52:05 -0700 (PDT) Received: from localhost ([::1]:48609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dugM8-00043M-M8 for importer@patchew.org; Wed, 20 Sep 2017 10:52:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dufP5-0006Wb-9B for qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:51:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dufP2-0004GR-7U for qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:51:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dufP1-0004GB-Vd for qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:51:00 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8KDol22059526 for ; Wed, 20 Sep 2017 09:50:58 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d3r0pf813-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 20 Sep 2017 09:50:58 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Sep 2017 14:50:56 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Sep 2017 14:50:53 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8KDorwp19267630; Wed, 20 Sep 2017 13:50:53 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A3CCCAE053; Wed, 20 Sep 2017 14:45:45 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 90413AE04D; Wed, 20 Sep 2017 14:45:45 +0100 (BST) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 20 Sep 2017 14:45:45 +0100 (BST) Received: from bahia.lan (icon-9-167-240-87.megacenter.de.ibm.com [9.167.240.87]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 3C056220154; Wed, 20 Sep 2017 15:50:52 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Wed, 20 Sep 2017 15:50:37 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170920135038.21058-1-groug@kaod.org> References: <20170920135038.21058-1-groug@kaod.org> X-TM-AS-GCONF: 00 x-cbid: 17092013-0008-0000-0000-00000498AE30 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092013-0009-0000-0000-00001E29E506 Message-Id: <20170920135038.21058-3-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-20_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=13 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709200189 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 2/3] 9pfs: fix name_to_path assertion in v9fs_complete_rename() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jan Dakinevich , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jan Dakinevich The third parameter of v9fs_co_name_to_path() must not contain `/' character. The issue is most likely related to 9p2000.u protocol only. Signed-off-by: Jan Dakinevich [groug, regression caused by commit f57f5878578a # 2.10] Signed-off-by: Greg Kurz --- hw/9pfs/9p.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 1078cfdaa4af..cdd44bdc82ef 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2553,13 +2553,11 @@ static int coroutine_fn v9fs_complete_rename(V9fsPD= U *pdu, V9fsFidState *fidp, int32_t newdirfid, V9fsString *name) { - char *end; int err =3D 0; V9fsPath new_path; V9fsFidState *tfidp; V9fsState *s =3D pdu->s; V9fsFidState *dirfidp =3D NULL; - char *old_name, *new_name; =20 v9fs_path_init(&new_path); if (newdirfid !=3D -1) { @@ -2577,18 +2575,15 @@ static int coroutine_fn v9fs_complete_rename(V9fsPD= U *pdu, V9fsFidState *fidp, goto out; } } else { - old_name =3D fidp->path.data; - end =3D strrchr(old_name, '/'); - if (end) { - end++; - } else { - end =3D old_name; - } - new_name =3D g_malloc0(end - old_name + name->size + 1); - strncat(new_name, old_name, end - old_name); - strncat(new_name + (end - old_name), name->data, name->size); - err =3D v9fs_co_name_to_path(pdu, NULL, new_name, &new_path); - g_free(new_name); + char *dir_name =3D g_path_get_dirname(fidp->path.data); + V9fsPath dir_path; + + v9fs_path_init(&dir_path); + v9fs_path_sprintf(&dir_path, "%s", dir_name); + g_free(dir_name); + + err =3D v9fs_co_name_to_path(pdu, &dir_path, name->data, &new_path= ); + v9fs_path_free(&dir_path); if (err < 0) { goto out; } --=20 2.13.5