From patchwork Mon Oct 17 15:05:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 683077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3syMJP4RwHz9sxS for ; Tue, 18 Oct 2016 02:17:25 +1100 (AEDT) Received: from localhost ([::1]:33806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw9fG-0002uS-8M for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2016 11:17:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw9V0-0000xw-3g for qemu-devel@nongnu.org; Mon, 17 Oct 2016 11:06:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw9Uw-0005Qo-VE for qemu-devel@nongnu.org; Mon, 17 Oct 2016 11:06:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42660 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bw9Uw-0005Qh-Ok for qemu-devel@nongnu.org; Mon, 17 Oct 2016 11:06:42 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9HF54os002756 for ; Mon, 17 Oct 2016 11:06:42 -0400 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0b-001b2d01.pphosted.com with ESMTP id 264xed8yc5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 17 Oct 2016 11:06:41 -0400 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Oct 2016 16:06:40 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 17 Oct 2016 16:06:39 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id CA46F17D805F for ; Mon, 17 Oct 2016 16:08:49 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9HF6cMU10158410 for ; Mon, 17 Oct 2016 15:06:38 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9HE6dTD027192 for ; Mon, 17 Oct 2016 08:06:40 -0600 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u9HE6dRc027177; Mon, 17 Oct 2016 08:06:39 -0600 Received: from bahia.localdomain (sig-9-83-37-45.evts.uk.ibm.com [9.83.37.45]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 9F9AA2200CB; Mon, 17 Oct 2016 17:06:36 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 17:05:53 +0200 X-Mailer: git-send-email 2.5.5 In-Reply-To: <1476716754-26686-1-git-send-email-groug@kaod.org> References: <1476716754-26686-1-git-send-email-groug@kaod.org> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101715-0036-0000-0000-00000245EBAF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101715-0037-0000-0000-000012E37576 Message-Id: <1476716754-26686-12-git-send-email-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-17_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=67 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610170265 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL 11/12] 9pfs: fix memory leak in v9fs_link 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 , Li Qiang , "Aneesh Kumar K.V" , Greg Kurz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang The v9fs_link() function keeps a reference on the source fid object. This causes a memory leak since the reference never goes down to 0. This patch fixes the issue. Signed-off-by: Li Qiang Reviewed-by: Greg Kurz [groug, rephrased the changelog] Signed-off-by: Greg Kurz --- hw/9pfs/9p.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 66135cf12183..d43a55223492 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2413,6 +2413,7 @@ static void coroutine_fn v9fs_link(void *opaque) if (!err) { err = offset; } + put_fid(pdu, oldfidp); out: put_fid(pdu, dfidp); out_nofid: