提交 49ea3b04 编写于 作者: E Elias Oltmanns 提交者: Jeff Garzik

libata-core: make sure that ata_force_tbl is freed in case of an error

Fix a potential memory leak when ata_init() encounters an error.
Signed-off-by: NElias Oltmanns <eo@nebensachen.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 2486fa56
......@@ -6098,16 +6098,20 @@ static int __init ata_init(void)
ata_wq = create_workqueue("ata");
if (!ata_wq)
return -ENOMEM;
goto free_force_tbl;
ata_aux_wq = create_singlethread_workqueue("ata_aux");
if (!ata_aux_wq) {
destroy_workqueue(ata_wq);
return -ENOMEM;
}
if (!ata_aux_wq)
goto free_wq;
printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
return 0;
free_wq:
destroy_workqueue(ata_wq);
free_force_tbl:
kfree(ata_force_tbl);
return -ENOMEM;
}
static void __exit ata_exit(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册