cifs: fix another memleak, in cifs_root_iget
Subsystems (2)
PATCH 1/1 cifs: fix another memleak, in cifs_root_iget
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.
--- fs/cifs/inode.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
fs/cifs/inode.c +6 -6
@@ -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
Signature · 1 line
1.7.0.4
Quoted 9 lines · Oskar Schirmer
cifs_root_igetallocatesfull_paththroughcifs_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 <[email protected]>
I've reviewed your patch (although not actually tested it) and your changes look sane.
So, feel free to add
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please.
Patch is obviously correct. Merged.
Quoted 29 lines · Jesper Juhl
Quoted 9 lines · Oskar Schirmer
cifs_root_igetallocatesfull_paththroughcifs_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 <[email protected]>I've reviewed your patch (although not actually tested it) and your changes look sane.
So, feel free to addReviewed-by Jesper Juhl <[email protected]>--
Jesper Juhl <[email protected]> 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Thanks, Steve