Skip to content

Commit eaba583

Browse files
YuuoniyAlex Williamson
authored andcommitted
hisi_acc_vfio_pci: Fix reference leak in hisi_acc_vfio_debug_init
The debugfs_lookup() function returns a dentry with an increased reference count that must be released by calling dput(). Fixes: b398f91 ("hisi_acc_vfio_pci: register debugfs for hisilicon migration driver") Cc: stable@vger.kernel.org Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Longfang Liu <liulongfang@huawei.com> Link: https://lore.kernel.org/r/20250901081809.2286649-1-linmq006@gmail.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 801ca4c commit eaba583

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,8 +1612,10 @@ static void hisi_acc_vfio_debug_init(struct hisi_acc_vf_core_device *hisi_acc_vd
16121612
}
16131613

16141614
migf = kzalloc(sizeof(*migf), GFP_KERNEL);
1615-
if (!migf)
1615+
if (!migf) {
1616+
dput(vfio_dev_migration);
16161617
return;
1618+
}
16171619
hisi_acc_vdev->debug_migf = migf;
16181620

16191621
vfio_hisi_acc = debugfs_create_dir("hisi_acc", vfio_dev_migration);
@@ -1623,6 +1625,8 @@ static void hisi_acc_vfio_debug_init(struct hisi_acc_vf_core_device *hisi_acc_vd
16231625
hisi_acc_vf_migf_read);
16241626
debugfs_create_devm_seqfile(dev, "cmd_state", vfio_hisi_acc,
16251627
hisi_acc_vf_debug_cmd);
1628+
1629+
dput(vfio_dev_migration);
16261630
}
16271631

16281632
static void hisi_acc_vf_debugfs_exit(struct hisi_acc_vf_core_device *hisi_acc_vdev)

0 commit comments

Comments
 (0)