From: Zhouyi Zhou Date: Wed, 8 Jun 2016 22:33:53 +0000 (-0700) Subject: kernel/relay.c: fix potential memory leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ba62bafe942b159a6109cbec780d36496e06b6c5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Jens Axboe Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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);