lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2375c9f90910150247u5ccb8e2at58c764e385ffa490@mail.gmail.com>
Date:	Thu, 15 Oct 2009 17:47:54 +0800
From:	Américo Wang <xiyou.wangcong@...il.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Tom Zanussi <tzanussi@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/4] tracing/profile: Add filter support

On Thu, Oct 15, 2009 at 11:21 AM, Li Zefan <lizf@...fujitsu.com> wrote:
> - Add an ioctl to allocate a filter for a perf event.
>
> - Free the filter when the associated perf event is to be freed.
>
> - Do the filtering in perf_swevent_match().
>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>

{snip}

> +int ftrace_profile_set_filter(struct perf_event *event, int event_id,
> +                             char *filter_str)
> +{
> +       int err;
> +       struct event_filter *filter;
> +       struct filter_parse_state *ps;
> +       struct ftrace_event_call *call = NULL;
> +
> +       mutex_lock(&event_mutex);
> +
> +       list_for_each_entry(call, &ftrace_events, list) {
> +               if (call->id == event_id)
> +                       break;
> +       }
> +       if (!call)
> +               return -EINVAL;
> +
> +       if (event->filter)
> +               return -EEXIST;
> +
> +       filter = __alloc_preds();
> +       if (IS_ERR(filter))
> +               return PTR_ERR(filter);


Just return will leave &event_mutex locked...

Am I missing something here?

> +
> +       err = -ENOMEM;
> +       ps = kzalloc(sizeof(*ps), GFP_KERNEL);
> +       if (!ps)
> +               goto free_preds;
> +
> +       parse_init(ps, filter_ops, filter_str);
> +       err = filter_parse(ps);
> +       if (err)
> +               goto free_ps;
> +
> +       err = replace_preds(call, filter, ps, filter_str, false);
> +       if (!err)
> +               event->filter = filter;
> +
> +free_ps:
> +       filter_opstack_clear(ps);
> +       postfix_clear(ps);
> +       kfree(ps);
> +
> +free_preds:
> +       if (err)
> +               __free_preds(filter);
> +
> +       mutex_unlock(&event_mutex);
> +
> +       return err;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ