Skip to content

Commit

Permalink
kernel/relay.c: fix potential memory leak
Browse files Browse the repository at this point in the history
When relay_open_buf() fails in relay_open(), code will goto free_bufs,
but chan is nowhere freed.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Zhouyi Zhou <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Zhouyi Zhou authored and torvalds committed Jun 9, 2016
1 parent 770a537 commit ba62baf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ struct rchan *relay_open(const char *base_filename,

kref_put(&chan->kref, relay_destroy_channel);
mutex_unlock(&relay_channels_mutex);
kfree(chan);
return NULL;
}
EXPORT_SYMBOL_GPL(relay_open);
Expand Down

0 comments on commit ba62baf

Please sign in to comment.