linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix: perf data convert: leak of bt_ctf_field_type
@ 2016-10-22 19:57 Jérémie Galarneau
  2016-10-23 11:43 ` Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: Jérémie Galarneau @ 2016-10-22 19:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jérémie Galarneau, Wang Nan, Philippe Proulx,
	David S . Miller, Alexei Starovoitov, Brendan Gregg, Jiri Olsa,
	Masami Hiramatsu, Namhyung Kim, Zefan Li, pi3orama

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 <jeremie.galarneau@efficios.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Philippe Proulx <philippe.proulx@efficios.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix: perf data convert: leak of bt_ctf_field_type
  2016-10-22 19:57 [PATCH] Fix: perf data convert: leak of bt_ctf_field_type Jérémie Galarneau
@ 2016-10-23 11:43 ` Jiri Olsa
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Olsa @ 2016-10-23 11:43 UTC (permalink / raw)
  To: Jérémie Galarneau, Philippe Proulx
  Cc: linux-kernel, Wang Nan, David S . Miller, Alexei Starovoitov,
	Brendan Gregg, Jiri Olsa, Masami Hiramatsu, Namhyung Kim,
	Zefan Li, pi3orama

On Sat, Oct 22, 2016 at 03:57:27PM -0400, Jérémie Galarneau wrote:
> 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.

this actualy looks like good solution, sry we missed that first time

Could one of you guys please resend that?

thanks,
jirka

> 
> 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 <jeremie.galarneau@efficios.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Cc: Philippe Proulx <philippe.proulx@efficios.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Zefan Li <lizefan@huawei.com>
> 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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-23 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-22 19:57 [PATCH] Fix: perf data convert: leak of bt_ctf_field_type Jérémie Galarneau
2016-10-23 11:43 ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).