mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mtd: amd76xrom: Fix PCI device reference leak in amd76xrom_init_one()
init_amd76xrom() obtains the PCI device with pci_get_device() and
hands the reference over to amd76xrom_init_one(), which stores it in
window->pdev. When reserving the ROM window fails, that function
returns -EBUSY directly instead of going through amd76xrom_cleanup(),
so the reference is neither released nor cleared.
Drop the reference and clear window->pdev on that path.
Fixes: dd8e9ed6ed ("[MTD] Switch to pci_get_device and do ref counting")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
cfc5ebc954
commit
1a122f5fec
|
|
@ -152,6 +152,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev,
|
|||
printk(KERN_ERR MOD_NAME
|
||||
" %s(): Unable to register resource %pR - kernel bug?\n",
|
||||
__func__, &window->rsrc);
|
||||
pci_dev_put(window->pdev);
|
||||
window->pdev = NULL;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user