[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <47e97b77-edfa-3a90-f74c-068b24afe917@huawei.com>
Date: Tue, 2 Sep 2025 10:23:08 +0800
From: liulongfang <liulongfang@...wei.com>
To: Miaoqian Lin <linmq006@...il.com>, Shameer Kolothum
<shameerali.kolothum.thodi@...wei.com>, Jason Gunthorpe <jgg@...pe.ca>,
Yishai Hadas <yishaih@...dia.com>, Kevin Tian <kevin.tian@...el.com>, Alex
Williamson <alex.williamson@...hat.com>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: <stable@...r.kernel.org>
Subject: Re: [PATCH] hisi_acc_vfio_pci: Fix reference leak in
hisi_acc_vfio_debug_init
On 2025/9/1 16:18, Miaoqian Lin wrote:
> The debugfs_lookup() function returns a dentry with an increased reference
> count that must be released by calling dput().
>
> Fixes: b398f91779b8 ("hisi_acc_vfio_pci: register debugfs for hisilicon migration driver")
> Cc: stable@...r.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
> drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index 2149f49aeec7..1710485cbbec 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1611,8 +1611,10 @@ static void hisi_acc_vfio_debug_init(struct hisi_acc_vf_core_device *hisi_acc_vd
> }
>
> migf = kzalloc(sizeof(*migf), GFP_KERNEL);
> - if (!migf)
> + if (!migf) {
> + dput(vfio_dev_migration);
> return;
> + }
> hisi_acc_vdev->debug_migf = migf;
>
> vfio_hisi_acc = debugfs_create_dir("hisi_acc", vfio_dev_migration);
> @@ -1622,6 +1624,8 @@ static void hisi_acc_vfio_debug_init(struct hisi_acc_vf_core_device *hisi_acc_vd
> hisi_acc_vf_migf_read);
> debugfs_create_devm_seqfile(dev, "cmd_state", vfio_hisi_acc,
> hisi_acc_vf_debug_cmd);
> +
> + dput(vfio_dev_migration);
> }
>
Reviewed-by: Longfang Liu <liulongfang@...wei.com>
Thanks!
Longfang.
> static void hisi_acc_vf_debugfs_exit(struct hisi_acc_vf_core_device *hisi_acc_vdev)
>
Powered by blists - more mailing lists