lkml.org 
[lkml]   [2011]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/9] ftrace: Fix possible NULL dereferencing in __ftrace_hash_rec_update
From
Date
On Sun, 2011-11-27 at 19:04 +0100, Jiri Olsa wrote:
> We need to check the existence of the other_hash before
> we touch its count variable.
>
> This issue is hit only when non global ftrace_ops is used.
> The global ftrace_ops is initialized with empty hashes.
>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
> kernel/trace/ftrace.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index b1e8943..c6d0293 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1372,7 +1372,8 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
> if (filter_hash && in_hash && !in_other_hash)
> match = 1;
> else if (!filter_hash && in_hash &&
> - (in_other_hash || !other_hash->count))
> + (in_other_hash ||
> + !other_hash || !other_hash->count))

Thanks! I hit this bug in too many places. I need to make a helper
routine, which I think I will, that is:

hash_has_contents(hash)

that does the check for us.

-- Steve

> match = 1;
> }
> if (!match)




\
 
 \ /
  Last update: 2011-11-28 17:27    [W:1.784 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site