From: Wenwen Wang <wenwen@cs.uga.edu>
To: Wenwen Wang <wenwen@cs.uga.edu>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial
and Parallel ATA drivers)),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] libata: Fix a memory leak bug
Date: Fri, 16 Aug 2019 22:58:29 -0500 [thread overview]
Message-ID: <1566014309-3045-1-git-send-email-wenwen@cs.uga.edu> (raw)
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@cs.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
reply other threads:[~2019-08-17 3:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1566014309-3045-1-git-send-email-wenwen@cs.uga.edu \
--to=wenwen@cs.uga.edu \
--cc=axboe@kernel.dk \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).