From: "Darren Jenkins\\" <darrenrjenkins@gmail.com>
To: kernel Janitors <kernel-janitors@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
hirofumi@mail.parknet.co.jp
Subject: [PATCH] fs/fat/dir.c fix resource leak
Date: Tue, 29 Jul 2008 10:03:33 +1000 [thread overview]
Message-ID: <1217289813.9367.9.camel@localhost.localdomain> (raw)
G'day people,
Coverity CID 2332 & 2333 RESOURCE_LEAK
In fat_search_long() if fat_parse_long() returns a -ve value we return
without first freeing unicode and bufname.
This patch free's them on this error path.
Patch against linux-next commit 99be8ca04aa13c0ff10bbb3ba5f90676b050fcc6
Only compile tested
Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 34541d0..8a9d7fa 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -346,14 +346,16 @@ parse_record:
if (de->attr == ATTR_EXT) {
int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots);
- if (status < 0)
- return status;
- else if (status == PARSE_INVALID)
+ if (status < 0) {
+ err = status;
+ goto EODir;
+ } else if (status == PARSE_INVALID) {
continue;
- else if (status == PARSE_NOT_LONGNAME)
+ } else if (status == PARSE_NOT_LONGNAME) {
goto parse_record;
- else if (status == PARSE_EOF)
+ } else if (status == PARSE_EOF) {
goto EODir;
+ }
}
memcpy(work, de->name, sizeof(de->name));
next reply other threads:[~2008-07-29 11:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-29 0:03 Darren Jenkins\ [this message]
2008-07-29 12:55 ` OGAWA Hirofumi
2008-07-29 13:06 ` OGAWA Hirofumi
2008-07-30 9:15 ` Darren Jenkins
2008-07-30 15:04 ` OGAWA Hirofumi
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=1217289813.9367.9.camel@localhost.localdomain \
--to=darrenrjenkins@gmail.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=kernel-janitors@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
Powered by JetHome