Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4230639rwb; Tue, 20 Sep 2022 10:36:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qXc1fZwCvcbFScA3b1hqOFD6/pUyRUwSYW1BbvjxiM8AxHvZsRkKGgVKkvXtkM90H8vN2 X-Received: by 2002:a17:90b:3883:b0:203:214d:4272 with SMTP id mu3-20020a17090b388300b00203214d4272mr4962070pjb.101.1663695372859; Tue, 20 Sep 2022 10:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663695372; cv=none; d=google.com; s=arc-20160816; b=GBLnjwZi7nWXFK8siH/pdKSyvg3swA85u59Qq5AlerukM9Eh88B1fujsEbLoK94ytg e3LGds/NXPqeoO9sMvmCitlrV7ZnJkdn6j+EWbA10P0h0/Cozurt32n6wo+MeeppH0Wg wxJ+nSrIrXAVlfSgpExlgkNRrbn/mWYuvWV8FBME/gBIQlBfR8FvBl6zqG/7GHxD93wL 2LNLanjecY10hBzfbtW9NgAokf8tu9wH12Uz+Dfp2lrQfUw0tPNFtuX9uU2cFf72ytkr efHcY2Y/k0Nq+8uD6qCqPdq25hen5zPyMvcDs1Kp/UW0JMeNtWcen54gj3Pz75IwLouQ /7TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=4kdNYboTsynOVKXeN34P1BoIViyowmXZAZflmX4wvVA=; b=h4zuweHHy9OpTG5mTLnLgGb4ErgH21SlzOkms1rccu4jlY++IBak85CQDe46NxX5Kp b6wZXhVbSFyFWCtEKX4K5WY6sfYrpXD2oBDDn66TjdEt4UifCqw37KVspA8fA+uZNidu /7lNi4ioLBqlzXzjL7k76T9Bf5zd0oGOXRGcSuaazKKhQN1IFDkNG7bleZfa5JG4JnXR bfAqUnFRuF8H4H/hmJTAeRotkTQg49cFBuUH82Sllb5lE4uDmXtBybdVy/5WRG7ZIRPS vHmYZJX9PBYhUujreo1U5djgVb4Pg2VHIXhYPLKPwpgRgtisDbXi3nDnngeWXmdSN2J4 gvLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020aa792c9000000b005430d8426fcsi270059pfa.142.2022.09.20.10.36.01; Tue, 20 Sep 2022 10:36:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbiITRDp convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Sep 2022 13:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231342AbiITRDl (ORCPT ); Tue, 20 Sep 2022 13:03:41 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C938501AF for ; Tue, 20 Sep 2022 10:03:40 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MX79j1xwyzHnxQ; Wed, 21 Sep 2022 01:01:29 +0800 (CST) Received: from kwepemm000006.china.huawei.com (7.193.23.237) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 01:03:37 +0800 Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by kwepemm000006.china.huawei.com (7.193.23.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 21 Sep 2022 01:03:36 +0800 Received: from lhrpeml500005.china.huawei.com ([7.191.163.240]) by lhrpeml500005.china.huawei.com ([7.191.163.240]) with mapi id 15.01.2375.031; Tue, 20 Sep 2022 18:03:34 +0100 From: Shameerali Kolothum Thodi To: Jason Gunthorpe , Alex Williamson CC: liulongfang , "cohuck@redhat.com" , "linux-kernel@vger.kernel.org" , "linuxarm@openeuler.org" Subject: RE: [PATCH 1/5] hisi_acc_vfio_pci: Fixes a memory leak bug Thread-Topic: [PATCH 1/5] hisi_acc_vfio_pci: Fixes a memory leak bug Thread-Index: AQHYyKNl0n81Lxv0MUKz8I4GKo4bYq3oe7uAgAABAQCAABOTkA== Date: Tue, 20 Sep 2022 17:03:34 +0000 Message-ID: <04a17bfa71c440e8a38cba2337a8c6ac@huawei.com> References: <20220915013157.60771-1-liulongfang@huawei.com> <20220915013157.60771-2-liulongfang@huawei.com> <20220920103443.72654dd7.alex.williamson@redhat.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.227.178] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Jason Gunthorpe [mailto:jgg@nvidia.com] > Sent: 20 September 2022 17:38 > To: Alex Williamson > Cc: liulongfang ; Shameerali Kolothum Thodi > ; cohuck@redhat.com; > linux-kernel@vger.kernel.org; linuxarm@openeuler.org > Subject: Re: [PATCH 1/5] hisi_acc_vfio_pci: Fixes a memory leak bug > > On Tue, Sep 20, 2022 at 10:34:43AM -0600, Alex Williamson wrote: > > On Thu, 15 Sep 2022 09:31:53 +0800 > > Longfang Liu wrote: > > > > > During the stop copy phase of live migration, the driver allocates a > > > memory for the migrated data to save the data. > > > > > > When an exception occurs when the driver reads device data, the > > > driver will report an error to qemu and exit the current migration state. > > > But this memory is not released, which will lead to a memory leak > > > problem. > > Why isn't it released? The fput() releases it: > > static int hisi_acc_vf_release_file(struct inode *inode, struct file *filp) { > struct hisi_acc_vf_migration_file *migf = filp->private_data; > > hisi_acc_vf_disable_fd(migf); > mutex_destroy(&migf->lock); > kfree(migf); > ^^^^^^^^^^ > > This patch looks wrong to me. That's right. Missed that. Sorry of the oversight. Thanks, Shameer