linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tracing: don't stuff stale pointers in filp->private_data
@ 2013-09-20 16:47 Dave Jones
  2013-09-21 14:32 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Jones @ 2013-09-20 16:47 UTC (permalink / raw)
  To: rostedt; +Cc: Linux Kernel

Probably harmless, but still not a nice thing to do.

Signed-off-by: Dave Jones <davej@fedoraproject.org>

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 368a4d5..75d3556 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1124,6 +1124,7 @@ static int system_tr_open(struct inode *inode, struct file *filp)
 	if (ret < 0) {
 		trace_array_put(tr);
 		kfree(dir);
+		dir = NULL;
 	}
 
 	filp->private_data = dir;

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

* Re: tracing: don't stuff stale pointers in filp->private_data
  2013-09-20 16:47 tracing: don't stuff stale pointers in filp->private_data Dave Jones
@ 2013-09-21 14:32 ` Al Viro
  2013-09-21 15:37   ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2013-09-21 14:32 UTC (permalink / raw)
  To: Dave Jones, rostedt, Linux Kernel

On Fri, Sep 20, 2013 at 12:47:32PM -0400, Dave Jones wrote:
> Probably harmless, but still not a nice thing to do.
> 
> Signed-off-by: Dave Jones <davej@fedoraproject.org>
> 
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 368a4d5..75d3556 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -1124,6 +1124,7 @@ static int system_tr_open(struct inode *inode, struct file *filp)
>  	if (ret < 0) {
>  		trace_array_put(tr);
>  		kfree(dir);
> +		dir = NULL;
>  	}
>  
>  	filp->private_data = dir;

Er...  Why not simply return ret; instead?

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

* Re: tracing: don't stuff stale pointers in filp->private_data
  2013-09-21 14:32 ` Al Viro
@ 2013-09-21 15:37   ` Steven Rostedt
  2013-09-25 22:49     ` Dave Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2013-09-21 15:37 UTC (permalink / raw)
  To: Al Viro, Dave Jones, Linux Kernel

Or make the assignment in an else block.

-- Steve


Al Viro <viro@ZenIV.linux.org.uk> wrote:
>On Fri, Sep 20, 2013 at 12:47:32PM -0400, Dave Jones wrote:
>> Probably harmless, but still not a nice thing to do.
>> 
>> Signed-off-by: Dave Jones <davej@fedoraproject.org>
>> 
>> diff --git a/kernel/trace/trace_events.c
>b/kernel/trace/trace_events.c
>> index 368a4d5..75d3556 100644
>> --- a/kernel/trace/trace_events.c
>> +++ b/kernel/trace/trace_events.c
>> @@ -1124,6 +1124,7 @@ static int system_tr_open(struct inode *inode,
>struct file *filp)
>>  	if (ret < 0) {
>>  		trace_array_put(tr);
>>  		kfree(dir);
>> +		dir = NULL;
>>  	}
>>  
>>  	filp->private_data = dir;
>
>Er...  Why not simply return ret; instead?

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* tracing: don't stuff stale pointers in filp->private_data
  2013-09-21 15:37   ` Steven Rostedt
@ 2013-09-25 22:49     ` Dave Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Jones @ 2013-09-25 22:49 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Al Viro, Linux Kernel

Probably harmless, but still not a nice thing to do.

Signed-off-by: Dave Jones <davej@fedoraproject.org>

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 368a4d5..27aa16e 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1124,10 +1124,10 @@ static int system_tr_open(struct inode *inode, struct file *filp)
 	if (ret < 0) {
 		trace_array_put(tr);
 		kfree(dir);
+	} else {
+		filp->private_data = dir;
 	}
 
-	filp->private_data = dir;
-
 	return ret;
 }
 

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

end of thread, other threads:[~2013-09-25 22:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20 16:47 tracing: don't stuff stale pointers in filp->private_data Dave Jones
2013-09-21 14:32 ` Al Viro
2013-09-21 15:37   ` Steven Rostedt
2013-09-25 22:49     ` Dave Jones

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