Skip to content

Commit 8716a84

Browse files
Yuuoniygregkh
authored andcommitted
virtio: vdpa: Fix reference count leak in octep_sriov_enable()
commit b41ca62 upstream. pci_get_device() will increase the reference count for the returned pci_dev, and also decrease the reference count for the input parameter from if it is not NULL. If we break the loop in with 'vf_pdev' not NULL. We need to call pci_dev_put() to decrease the reference count. Found via static anlaysis and this is similar to commit c508eb0 ("perf/x86/intel/uncore: Fix reference count leak in sad_cfg_iio_topology()") Fixes: 8b6c724 ("virtio: vdpa: vDPA driver for Marvell OCTEON DPU devices") Cc: stable@vger.kernel.org Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20251027060737.33815-1-linmq006@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3846f8f commit 8716a84

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/vdpa/octeon_ep/octep_vdpa_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ static int octep_sriov_enable(struct pci_dev *pdev, int num_vfs)
736736
octep_vdpa_assign_barspace(vf_pdev, pdev, index);
737737
if (++index == num_vfs) {
738738
done = true;
739+
pci_dev_put(vf_pdev);
739740
break;
740741
}
741742
}

0 commit comments

Comments
 (0)