Skip to content

Commit c4aaad8

Browse files
Colin Ian Kinggregkh
authored andcommitted
gfs2: Fix memory leak of object lsi on error return path
[ Upstream commit a6579cb ] In the case where IS_ERR(lsi->si_sc_inode) is true the error exit path to free_local does not kfree the allocated object lsi leading to a memory leak. Fix this by kfree'ing lst before taking the error exit path. Addresses-Coverity: ("Resource leak") Fixes: 97fd734 ("gfs2: lookup local statfs inodes prior to journal recovery") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8c3b502 commit c4aaad8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎fs/gfs2/ops_fstype.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
660660
error = PTR_ERR(lsi->si_sc_inode);
661661
fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
662662
jd->jd_jid, error);
663+
kfree(lsi);
663664
goto free_local;
664665
}
665666
lsi->si_jid = jd->jd_jid;

0 commit comments

Comments
 (0)