* [PATCH] cifs: fix another memleak, in cifs_root_iget
@ 2010-11-10 21:06 Oskar Schirmer
2010-11-10 21:59 ` Jesper Juhl
0 siblings, 1 reply; 3+ messages in thread
From: Oskar Schirmer @ 2010-11-10 21:06 UTC (permalink / raw)
To: Steve French
Cc: stable, linux-cifs, linux-kernel, Suresh Jayaraman,
Andrew Hendry, Oskar Schirmer
cifs_root_iget allocates full_path through
cifs_build_path_to_root, but fails to kfree it upon
cifs_get_inode_info* failure.
Make all failure exit paths traverse clean up
handling at the end of the function.
Signed-off-by: Oskar Schirmer <oskar@scara.com>
Cc: stable@kernel.org
---
fs/cifs/inode.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index ef3a55b..ff7d299 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -881,8 +881,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
xid, NULL);
- if (!inode)
- return ERR_PTR(rc);
+ if (!inode) {
+ inode = ERR_PTR(rc);
+ goto out;
+ }
#ifdef CONFIG_CIFS_FSCACHE
/* populate tcon->resource_id */
@@ -898,13 +900,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
inode->i_uid = cifs_sb->mnt_uid;
inode->i_gid = cifs_sb->mnt_gid;
} else if (rc) {
- kfree(full_path);
- _FreeXid(xid);
iget_failed(inode);
- return ERR_PTR(rc);
+ inode = ERR_PTR(rc);
}
-
+out:
kfree(full_path);
/* can not call macro FreeXid here since in a void func
* TODO: This is no longer true
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: fix another memleak, in cifs_root_iget
2010-11-10 21:06 [PATCH] cifs: fix another memleak, in cifs_root_iget Oskar Schirmer
@ 2010-11-10 21:59 ` Jesper Juhl
2010-11-11 3:40 ` Steve French
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2010-11-10 21:59 UTC (permalink / raw)
To: Oskar Schirmer
Cc: Steve French, stable, linux-cifs, linux-kernel, Suresh Jayaraman,
Andrew Hendry
On Wed, 10 Nov 2010, Oskar Schirmer wrote:
> cifs_root_iget allocates full_path through
> cifs_build_path_to_root, but fails to kfree it upon
> cifs_get_inode_info* failure.
>
> Make all failure exit paths traverse clean up
> handling at the end of the function.
>
> Signed-off-by: Oskar Schirmer <oskar@scara.com>
> Cc: stable@kernel.org
I've reviewed your patch (although not actually tested it) and your
changes look sane.
So, feel free to add
Reviewed-by: Jesper Juhl <jj@chaosbits.net>
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: fix another memleak, in cifs_root_iget
2010-11-10 21:59 ` Jesper Juhl
@ 2010-11-11 3:40 ` Steve French
0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2010-11-11 3:40 UTC (permalink / raw)
To: Jesper Juhl
Cc: Oskar Schirmer, Steve French, stable, linux-cifs, linux-kernel,
Suresh Jayaraman, Andrew Hendry
Patch is obviously correct. Merged.
On Wed, Nov 10, 2010 at 3:59 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> On Wed, 10 Nov 2010, Oskar Schirmer wrote:
>
>> cifs_root_iget allocates full_path through
>> cifs_build_path_to_root, but fails to kfree it upon
>> cifs_get_inode_info* failure.
>>
>> Make all failure exit paths traverse clean up
>> handling at the end of the function.
>>
>> Signed-off-by: Oskar Schirmer <oskar@scara.com>
>> Cc: stable@kernel.org
>
> I've reviewed your patch (although not actually tested it) and your
> changes look sane.
> So, feel free to add
>
> Reviewed-by: Jesper Juhl <jj@chaosbits.net>
>
>
> --
> Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-11 3:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-10 21:06 [PATCH] cifs: fix another memleak, in cifs_root_iget Oskar Schirmer
2010-11-10 21:59 ` Jesper Juhl
2010-11-11 3:40 ` Steve French
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).