[lvc-project] [PATCH] tracing: remove unreachable trace_array_put

Steven Rostedt rostedt at goodmis.org
Sat Jul 13 02:33:06 MSK 2024


On Fri, 12 Jul 2024 23:12:58 +0300
Nikita Kiryushin <kiryushin at ancud.ru> wrote:

> There is a trace_array_put() in check result for
> nonseekable_open() in tracing_buffers_open(). However,
> it would be never executed as nonseekable_open never fails
> (by design).
> 
> Remove the check and associated unreachable code.

Then why does it return a value?

If someday it can return a failure, this would then cause a leak. It
doesn't hurt to leave it in.

So NACK.

-- Steve


> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 7b85af630348 ("tracing: Get trace_array ref counts when accessing trace files")
> Signed-off-by: Nikita Kiryushin <kiryushin at ancud.ru>
> ---
>  kernel/trace/trace.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 578a49ff5c32..7e480501b509 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -7883,11 +7883,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)
>  
>  	mutex_unlock(&trace_types_lock);
>  
> -	ret = nonseekable_open(inode, filp);
> -	if (ret < 0)
> -		trace_array_put(tr);
> -
> -	return ret;
> +	return nonseekable_open(inode, filp);
>  }
>  
>  static __poll_t




More information about the lvc-project mailing list