Re: [PATCH] tracing: Fix memory leak in tracing_err_log_open()
From: Steven Rostedt
Date: Thu Jun 27 2019 - 21:07:12 EST
On Thu, 27 Jun 2019 21:02:31 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > +++ b/kernel/trace/trace.c
> > @@ -7126,12 +7126,24 @@ static ssize_t tracing_err_log_write(struct file *file,
> > return count;
> > }
> >
> > +static int tracing_err_log_release(struct inode *inode, struct file *file)
> > +{
> > + struct trace_array *tr = inode->i_private;
> > +
> > + trace_array_put(tr);
> > +
> > + if (file->private_data)
Actually, I think it is safer to have the condition be:
if (file->f_mode & FMODE_READ)
As that would match the open.
Takeshi,
Can you send a v2?
Thanks!
-- Steve
> > + seq_release(inode, file);
> > +
> > + return 0;
> > +}
> > +