Skip to content

Commit cb0aae0

Browse files
zhengbin13martinetd
authored andcommitted
9p: Fix memory leak in v9fs_mount
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/[email protected] Fixes: 60e78d2 ("9p: Add fscache support to 9p") Cc: <[email protected]> # v2.6.32+ Signed-off-by: Zheng Bin <[email protected]> Signed-off-by: Dominique Martinet <[email protected]>
1 parent 6624664 commit cb0aae0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/9p/v9fs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
500500
}
501501

502502
#ifdef CONFIG_9P_FSCACHE
503-
if (v9ses->fscache) {
503+
if (v9ses->fscache)
504504
v9fs_cache_session_put_cookie(v9ses);
505-
kfree(v9ses->cachetag);
506-
}
505+
kfree(v9ses->cachetag);
507506
#endif
508507
kfree(v9ses->uname);
509508
kfree(v9ses->aname);

0 commit comments

Comments
 (0)