diff options
author | Colin Ian King <colin.king@canonical.com> | 2021-07-12 19:24:30 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-15 10:50:32 +0300 |
commit | c4aaad8a338958016d4a0633564ec1c15341efea (patch) | |
tree | 5679ac3f347ae3020c2ea89c4d4d1d9978d41e77 /fs | |
parent | 8c3b5028ec02924f3b037a6d07124a006a9a3c4f (diff) | |
download | linux-c4aaad8a338958016d4a0633564ec1c15341efea.tar.xz |
gfs2: Fix memory leak of object lsi on error return path
[ Upstream commit a6579cbfd7216b071008db13360c322a6b21400b ]
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: 97fd734ba17e ("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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/ops_fstype.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index ae9c5c1bdc50..52c565ff047c 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -660,6 +660,7 @@ static int init_statfs(struct gfs2_sbd *sdp) error = PTR_ERR(lsi->si_sc_inode); fs_err(sdp, "can't find local \"sc\" file#%u: %d\n", jd->jd_jid, error); + kfree(lsi); goto free_local; } lsi->si_jid = jd->jd_jid; |