Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracefs fixes from Steven Rostedt:
"Al Viro has been looking at the tracefs code, and has pointed out some
issues. This contains one fix by me and one by Al. I'm sure that
he'll come up with more but for now I tested these patches and they
don't appear to have any negative impact on tracing"

* tag 'trace-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
fix memory leaks in tracing_buffers_splice_read()
tracing: Move mutex to protect against resetting of seq data

+16 -13
+16 -13
kernel/trace/trace.c
··· 5124 5124 struct trace_iterator *iter = filp->private_data; 5125 5125 ssize_t sret; 5126 5126 5127 - /* return any leftover data */ 5128 - sret = trace_seq_to_user(&iter->seq, ubuf, cnt); 5129 - if (sret != -EBUSY) 5130 - return sret; 5131 - 5132 - trace_seq_init(&iter->seq); 5133 - 5134 5127 /* 5135 5128 * Avoid more than one consumer on a single file descriptor 5136 5129 * This is just a matter of traces coherency, the ring buffer itself 5137 5130 * is protected. 5138 5131 */ 5139 5132 mutex_lock(&iter->mutex); 5133 + 5134 + /* return any leftover data */ 5135 + sret = trace_seq_to_user(&iter->seq, ubuf, cnt); 5136 + if (sret != -EBUSY) 5137 + goto out; 5138 + 5139 + trace_seq_init(&iter->seq); 5140 + 5140 5141 if (iter->trace->read) { 5141 5142 sret = iter->trace->read(iter, filp, ubuf, cnt, ppos); 5142 5143 if (sret) ··· 6164 6163 return -EBUSY; 6165 6164 #endif 6166 6165 6167 - if (splice_grow_spd(pipe, &spd)) 6168 - return -ENOMEM; 6169 - 6170 6166 if (*ppos & (PAGE_SIZE - 1)) 6171 6167 return -EINVAL; 6172 6168 ··· 6172 6174 return -EINVAL; 6173 6175 len &= PAGE_MASK; 6174 6176 } 6177 + 6178 + if (splice_grow_spd(pipe, &spd)) 6179 + return -ENOMEM; 6175 6180 6176 6181 again: 6177 6182 trace_access_lock(iter->cpu_file); ··· 6233 6232 /* did we read anything? */ 6234 6233 if (!spd.nr_pages) { 6235 6234 if (ret) 6236 - return ret; 6235 + goto out; 6237 6236 6237 + ret = -EAGAIN; 6238 6238 if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) 6239 - return -EAGAIN; 6239 + goto out; 6240 6240 6241 6241 ret = wait_on_pipe(iter, true); 6242 6242 if (ret) 6243 - return ret; 6243 + goto out; 6244 6244 6245 6245 goto again; 6246 6246 } 6247 6247 6248 6248 ret = splice_to_pipe(pipe, &spd); 6249 + out: 6249 6250 splice_shrink_spd(&spd); 6250 6251 6251 6252 return ret;