Re: [PATCH 1/1] tracing/latency_hist Fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/14/2014 06:26 PM, Carsten Emde wrote:
> The index_ptr memory that is allocated when printout is started
> currently is only returned when the printout is stopped
> prematurely. It is not returned when the printout regularly
> finishes. Fix this memory leak.
> 
> Signed-off-by: Carsten Emde <C.Emde@xxxxxxxxx>
> 
> Index: linux-3.12.10-rt15-somedebug/kernel/trace/latency_hist.c
> ===================================================================
> --- linux-3.12.10-rt15-somedebug.orig/kernel/trace/latency_hist.c
> +++ linux-3.12.10-rt15-somedebug/kernel/trace/latency_hist.c
> @@ -313,6 +313,7 @@ static void *l_next(struct seq_file *m, 
>  
>  	if (++*pos >= MAX_ENTRY_NUM) {
>  		atomic_inc(&my_hist->hist_mode);
> +		kfree(p);
>  		return NULL;
>  	}
>  	*index_ptr = *pos;

Sure on that? If I look at seq_read() I see that there is that ->stop()
is always called after ->start() / ->next() before returning to caller.
Based on this I would say that this patach will introduce a double free
of p.

> 
Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux