diff options
author | Wenwen Wang <wang6495@umn.edu> | 2019-04-19 21:22:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-02 09:40:28 +0200 |
commit | 5cc7ae880836c5943a773148e7a936728c750430 (patch) | |
tree | a6e4a99912c12798cdbd3c45c17c6c9cfcb84e11 /include/linux/pipe_fs_i.h | |
parent | 0bc43c8776d413d0b22f1d4719b226df36825b37 (diff) |
tracing: Fix a memory leak by early error exit in trace_pid_write()
commit 91862cc7867bba4ee5c8fcf0ca2f1d30427b6129 upstream.
In trace_pid_write(), the buffer for trace parser is allocated through
kmalloc() in trace_parser_get_init(). Later on, after the buffer is used,
it is then freed through kfree() in trace_parser_put(). However, it is
possible that trace_pid_write() is terminated due to unexpected errors,
e.g., ENOMEM. In that case, the allocated buffer will not be freed, which
is a memory leak bug.
To fix this issue, free the allocated buffer when an error is encountered.
Link: http://lkml.kernel.org/r/1555726979-15633-1-git-send-email-wang6495@umn.edu
Fixes: f4d34a87e9c10 ("tracing: Use pid bitmap instead of a pid array for set_event_pid")
Cc: stable@vger.kernel.org
Signed-off-by: Wenwen Wang <wang6495@umn.edu>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/pipe_fs_i.h')
0 files changed, 0 insertions, 0 deletions