ocfs2: free 'dummy_sc' in sc_fop_release() to prevent memory leak
authorpiaojun <[email protected]>
Thu, 6 Jul 2017 22:36:13 +0000 (15:36 -0700)
committerLinus Torvalds <[email protected]>
Thu, 6 Jul 2017 23:24:30 +0000 (16:24 -0700)
'sd->dbg_sock' is malloced in sc_common_open(), but not freed at the end
of sc_fop_release().

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jun Piao <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Junxiao Bi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ocfs2/cluster/netdebug.c

index 564c504d6efd8c99f903e95d96a87b47ce7db36a..74a21f6695c8526ec6efe7aca48d5d75fec76e4d 100644 (file)
@@ -426,6 +426,7 @@ static int sc_fop_release(struct inode *inode, struct file *file)
        struct o2net_sock_container *dummy_sc = sd->dbg_sock;
 
        o2net_debug_del_sc(dummy_sc);
+       kfree(dummy_sc);
        return seq_release_private(inode, file);
 }