Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756196AbcJVT53 (ORCPT ); Sat, 22 Oct 2016 15:57:29 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:35653 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756166AbcJVT50 (ORCPT ); Sat, 22 Oct 2016 15:57:26 -0400 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Galarneau?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Galarneau?= , Wang Nan , Philippe Proulx , "David S . Miller" , Alexei Starovoitov , Brendan Gregg , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , Zefan Li , pi3orama@163.com Subject: [PATCH] Fix: perf data convert: leak of bt_ctf_field_type Date: Sat, 22 Oct 2016 15:57:27 -0400 Message-Id: <20161022195727.13209-1-jeremie.galarneau@efficios.com> X-Mailer: git-send-email 2.10.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1783 Lines: 47 The ctf_writer structure contains an union of a structure containing 7 pointer members and an array of 6 struct bt_ctf_field_type*, which are used to release the references to these objects in ctf_writer__cleanup_data(). 26812d46 introduced the u32_hex member and should have increased the array's size. The disparity results in the last member of the "data" structure being leaked as its reference is never released/put. Philippe Proulx proposed a patch back in February which hasn't received any feedback and would eliminate the need to manually update this array. http://lkml.iu.edu/hypermail/linux/kernel/1602.1/03800.html CC-ing the people who were CC-ed on the original patch. Signed-off-by: Jérémie Galarneau Cc: Wang Nan Cc: Philippe Proulx Cc: David S. Miller Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: David S. Miller Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com --- tools/perf/util/data-convert-bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index 7123f4d..16364f0 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -67,7 +67,7 @@ struct ctf_writer { struct bt_ctf_field_type *u32_hex; struct bt_ctf_field_type *u64_hex; }; - struct bt_ctf_field_type *array[6]; + struct bt_ctf_field_type *array[7]; } data; struct bt_ctf_event_class *comm_class; struct bt_ctf_event_class *exit_class; -- 2.10.1