diff options
author | Zhouyi Zhou <yizhouzhou@ict.ac.cn> | 2016-06-08 15:33:53 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-09 14:23:11 -0700 |
commit | ba62bafe942b159a6109cbec780d36496e06b6c5 (patch) | |
tree | cece4935cb3bc79763d6ddba726c1739c722e397 /kernel/relay.c | |
parent | 770a5370226cb207461bbad902543381c1fad521 (diff) | |
download | lwn-ba62bafe942b159a6109cbec780d36496e06b6c5.tar.gz lwn-ba62bafe942b159a6109cbec780d36496e06b6c5.zip |
kernel/relay.c: fix potential memory leak
When relay_open_buf() fails in relay_open(), code will goto free_bufs,
but chan is nowhere freed.
Link: http://lkml.kernel.org/r/1464777927-19675-1-git-send-email-yizhouzhou@ict.ac.cn
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/relay.c')
-rw-r--r-- | kernel/relay.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/relay.c b/kernel/relay.c index 074994bcfa9b..04d7cf3ef8cf 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -614,6 +614,7 @@ free_bufs: kref_put(&chan->kref, relay_destroy_channel); mutex_unlock(&relay_channels_mutex); + kfree(chan); return NULL; } EXPORT_SYMBOL_GPL(relay_open); |