mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
tracing: Get trace_array reference for available_tracers files
commit194c2c74f5
upstream. As instances may have different tracers available, we need to look at the trace_array descriptor that shows the list of the available tracers for the instance. But there's a race between opening the file and an admin deleting the instance. The trace_array_get() needs to be called before accessing the trace_array. Cc: stable@vger.kernel.org Fixes:607e2ea167
("tracing: Set up infrastructure to allow tracers for instances") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c22c72ff4c
commit
faf6784df8
1 changed files with 15 additions and 2 deletions
|
@ -4152,9 +4152,14 @@ static int show_traces_open(struct inode *inode, struct file *file)
|
||||||
if (tracing_disabled)
|
if (tracing_disabled)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
if (trace_array_get(tr) < 0)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
ret = seq_open(file, &show_traces_seq_ops);
|
ret = seq_open(file, &show_traces_seq_ops);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
trace_array_put(tr);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
m = file->private_data;
|
m = file->private_data;
|
||||||
m->private = tr;
|
m->private = tr;
|
||||||
|
@ -4162,6 +4167,14 @@ static int show_traces_open(struct inode *inode, struct file *file)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int show_traces_release(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
struct trace_array *tr = inode->i_private;
|
||||||
|
|
||||||
|
trace_array_put(tr);
|
||||||
|
return seq_release(inode, file);
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
tracing_write_stub(struct file *filp, const char __user *ubuf,
|
tracing_write_stub(struct file *filp, const char __user *ubuf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
|
@ -4192,8 +4205,8 @@ static const struct file_operations tracing_fops = {
|
||||||
static const struct file_operations show_traces_fops = {
|
static const struct file_operations show_traces_fops = {
|
||||||
.open = show_traces_open,
|
.open = show_traces_open,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.release = seq_release,
|
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
|
.release = show_traces_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
|
|
Loading…
Reference in a new issue