[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200826091733.924-1-dinghao.liu@zju.edu.cn>
Date: Wed, 26 Aug 2020 17:17:33 +0800
From: Dinghao Liu <dinghao.liu@....edu.cn>
To: dinghao.liu@....edu.cn, kjlu@....edu
Cc: "David S. Miller" <davem@...emloft.net>, linux-ide@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ide: pci: Fix memleak in ide_pci_init_two
When do_ide_setup_pci_device() fails, host should be
freed just like when ide_host_register() fails.
Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
drivers/ide/setup-pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index fdc8e813170c..e6cba7e24c39 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -585,8 +585,10 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
* FIXME: Mom, mom, they stole me the helper function to undo
* do_ide_setup_pci_device() on the first device!
*/
- if (ret < 0)
+ if (ret < 0) {
+ ide_host_free(host);
goto out_free_bars;
+ }
/* fixup IRQ */
if (ide_pci_is_in_compatibility_mode(pdev[i])) {
--
2.17.1
Powered by blists - more mailing lists