]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
virtio: vdpa: Fix reference count leak in octep_sriov_enable()
authorMiaoqian Lin <linmq006@gmail.com>
Mon, 27 Oct 2025 06:07:35 +0000 (14:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:28 +0000 (12:57 +0100)
commit8716a841d1da4113e757b537b7d249c29d82e6db
treedc11b48367a8392e6ba706342b19ace73ce225b6
parent3846f8f781cc2758cbb40f99b9765954b1a5b568
virtio: vdpa: Fix reference count leak in octep_sriov_enable()

commit b41ca62c0019de1321d75f2b2f274a28784a41ed 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 c508eb042d97
("perf/x86/intel/uncore: Fix reference count leak in sad_cfg_iio_topology()")

Fixes: 8b6c724cdab8 ("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>
drivers/vdpa/octeon_ep/octep_vdpa_main.c