mirror of https://gitee.com/openkylin/linux.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 <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>
This commit is contained in:
parent
770a537022
commit
ba62bafe94
|
@ -614,6 +614,7 @@ struct rchan *relay_open(const char *base_filename,
|
||||||
|
|
||||||
kref_put(&chan->kref, relay_destroy_channel);
|
kref_put(&chan->kref, relay_destroy_channel);
|
||||||
mutex_unlock(&relay_channels_mutex);
|
mutex_unlock(&relay_channels_mutex);
|
||||||
|
kfree(chan);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(relay_open);
|
EXPORT_SYMBOL_GPL(relay_open);
|
||||||
|
|
Loading…
Reference in New Issue