summaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorZheng Bin <zhengbin13@huawei.com>2020-06-15 09:21:53 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-19 08:27:03 +0200
commiteb0b64b4817c3a36e1c7ebac462d4a57af5ff245 (patch)
tree9a19b3eb8c7b8d2d040bda7e97c8ed39e56da5b4 /fs/9p
parent72bc544c0dd41ec7b68f295025c4e8e06f75e575 (diff)
downloadlinux-stable-eb0b64b4817c3a36e1c7ebac462d4a57af5ff245.tar.gz
linux-stable-eb0b64b4817c3a36e1c7ebac462d4a57af5ff245.tar.bz2
linux-stable-eb0b64b4817c3a36e1c7ebac462d4a57af5ff245.zip
9p: Fix memory leak in v9fs_mount
commit cb0aae0e31c632c407a2cab4307be85a001d4d98 upstream. v9fs_mount v9fs_session_init v9fs_cache_session_get_cookie v9fs_random_cachetag -->alloc cachetag v9ses->fscache = fscache_acquire_cookie -->maybe NULL sb = sget -->fail, goto clunk clunk_fid: v9fs_session_close if (v9ses->fscache) -->NULL kfree(v9ses->cachetag) Thus memleak happens. Link: http://lkml.kernel.org/r/20200615012153.89538-1-zhengbin13@huawei.com Fixes: 60e78d2c993e ("9p: Add fscache support to 9p") Cc: <stable@vger.kernel.org> # v2.6.32+ Signed-off-by: Zheng Bin <zhengbin13@huawei.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/v9fs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 15a99f9c7253..39def020a074 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
}
#ifdef CONFIG_9P_FSCACHE
- if (v9ses->fscache) {
+ if (v9ses->fscache)
v9fs_cache_session_put_cookie(v9ses);
- kfree(v9ses->cachetag);
- }
+ kfree(v9ses->cachetag);
#endif
kfree(v9ses->uname);
kfree(v9ses->aname);