linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix a potential NULL dereference
@ 2018-03-23 11:37 Dan Carpenter
  2018-03-23 13:23 ` Tom Zanussi
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-03-23 11:37 UTC (permalink / raw)
  To: Steven Rostedt, Tom Zanussi; +Cc: Ingo Molnar, linux-kernel, kernel-janitors

We forgot to set the error code on this path so we return ERR_PTR(0)
which is NULL.  It results in a NULL dereference in the caller.

Fixes: 100719dcef44 ("tracing: Add simple expression support to hist triggers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 4f027642ceef..a02bc09d765a 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -2776,6 +2776,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
 		expr->fn = hist_field_plus;
 		break;
 	default:
+		ret = -EINVAL;
 		goto free;
 	}
 

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

* Re: [PATCH] tracing: Fix a potential NULL dereference
  2018-03-23 11:37 [PATCH] tracing: Fix a potential NULL dereference Dan Carpenter
@ 2018-03-23 13:23 ` Tom Zanussi
  2018-03-23 15:14   ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Zanussi @ 2018-03-23 13:23 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steven Rostedt, Ingo Molnar, linux-kernel, kernel-janitors

Hi Dan,

On Fri, 2018-03-23 at 14:37 +0300, Dan Carpenter wrote:
> We forgot to set the error code on this path so we return ERR_PTR(0)
> which is NULL.  It results in a NULL dereference in the caller.
> 
> Fixes: 100719dcef44 ("tracing: Add simple expression support to hist triggers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 4f027642ceef..a02bc09d765a 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -2776,6 +2776,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
>  		expr->fn = hist_field_plus;
>  		break;
>  	default:
> +		ret = -EINVAL;
>  		goto free;
>  	}
>  

Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>

Thanks for catching this!

Tom

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

* Re: [PATCH] tracing: Fix a potential NULL dereference
  2018-03-23 13:23 ` Tom Zanussi
@ 2018-03-23 15:14   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2018-03-23 15:14 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: Dan Carpenter, Ingo Molnar, linux-kernel, kernel-janitors

On Fri, 23 Mar 2018 08:23:13 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:


> Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> 
> Thanks for catching this!


Thanks Dan, applied.

-- Steve

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

end of thread, other threads:[~2018-03-23 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 11:37 [PATCH] tracing: Fix a potential NULL dereference Dan Carpenter
2018-03-23 13:23 ` Tom Zanussi
2018-03-23 15:14   ` Steven Rostedt

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).