Skip to content

Commit 725a521

Browse files
fenghusthualexdeucher
authored andcommitted
drm/radeon: Fix PCI device refcount leak in radeon_atrm_get_bios()
As comment of pci_get_class() says, it returns a pci_device with its refcount increased and decreased the refcount for the input parameter @from if it is not NULL. If we break the loop in radeon_atrm_get_bios() with 'pdev' not NULL, we need to call pci_dev_put() to decrease the refcount. Add the missing pci_dev_put() to avoid refcount leak. Fixes: d8ade35 ("drm/radeon: handle non-VGA class pci devices with ATRM") Fixes: c61e277 ("drm/radeon: split ATRM support out from the ATPX handler (v3)") Signed-off-by: Xiongfeng Wang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 7d4f8db commit 725a521

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/radeon/radeon_bios.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
227227

228228
if (!found)
229229
return false;
230+
pci_dev_put(pdev);
230231

231232
rdev->bios = kmalloc(size, GFP_KERNEL);
232233
if (!rdev->bios) {

0 commit comments

Comments
 (0)