[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1566014309-3045-1-git-send-email-wenwen@cs.uga.edu>
Date: Fri, 16 Aug 2019 22:58:29 -0500
From: Wenwen Wang <wenwen@...uga.edu>
To: Wenwen Wang <wenwen@...uga.edu>
Cc: Jens Axboe <axboe@...nel.dk>,
linux-ide@...r.kernel.org (open list:LIBATA SUBSYSTEM (Serial and
Parallel ATA drivers)), linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] libata: Fix a memory leak bug
In ata_init(), 'ata_force_tbl' is allocated through kcalloc() in
ata_parse_force_param(). However, it is not deallocated if
ata_attach_transport() fails, leading to a memory leak bug. To fix this
issue, free 'ata_force_tbl' before go to the 'err_out' label.
Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
---
drivers/ata/libata-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 28c492b..185dd69 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -7040,6 +7040,7 @@ static int __init ata_init(void)
ata_scsi_transport_template = ata_attach_transport();
if (!ata_scsi_transport_template) {
ata_sff_exit();
+ kfree(ata_force_tbl);
rc = -ENOMEM;
goto err_out;
}
--
2.7.4
Powered by blists - more mailing lists