Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
tracing/stat: Fix seqfile memory leak
function-graph: Fix seqfile memory leak
trace_stack: Fix seqfile memory leak
profile: Suppress warning about large allocations when profile=1 is specified

+36 -20
+12 -3
kernel/trace/ftrace.c
··· 2596 } 2597 2598 static int 2599 ftrace_set_func(unsigned long *array, int *idx, char *buffer) 2600 { 2601 struct dyn_ftrace *rec; ··· 2732 } 2733 2734 static const struct file_operations ftrace_graph_fops = { 2735 - .open = ftrace_graph_open, 2736 - .read = seq_read, 2737 - .write = ftrace_graph_write, 2738 }; 2739 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 2740
··· 2596 } 2597 2598 static int 2599 + ftrace_graph_release(struct inode *inode, struct file *file) 2600 + { 2601 + if (file->f_mode & FMODE_READ) 2602 + seq_release(inode, file); 2603 + return 0; 2604 + } 2605 + 2606 + static int 2607 ftrace_set_func(unsigned long *array, int *idx, char *buffer) 2608 { 2609 struct dyn_ftrace *rec; ··· 2724 } 2725 2726 static const struct file_operations ftrace_graph_fops = { 2727 + .open = ftrace_graph_open, 2728 + .read = seq_read, 2729 + .write = ftrace_graph_write, 2730 + .release = ftrace_graph_release, 2731 }; 2732 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 2733
+2 -5
kernel/trace/trace_stack.c
··· 301 302 static int stack_trace_open(struct inode *inode, struct file *file) 303 { 304 - int ret; 305 - 306 - ret = seq_open(file, &stack_trace_seq_ops); 307 - 308 - return ret; 309 } 310 311 static const struct file_operations stack_trace_fops = { 312 .open = stack_trace_open, 313 .read = seq_read, 314 .llseek = seq_lseek, 315 }; 316 317 int
··· 301 302 static int stack_trace_open(struct inode *inode, struct file *file) 303 { 304 + return seq_open(file, &stack_trace_seq_ops); 305 } 306 307 static const struct file_operations stack_trace_fops = { 308 .open = stack_trace_open, 309 .read = seq_read, 310 .llseek = seq_lseek, 311 + .release = seq_release, 312 }; 313 314 int
+22 -12
kernel/trace/trace_stat.c
··· 73 } 74 } 75 76 - static void reset_stat_session(struct stat_session *session) 77 { 78 struct rb_node *node = session->stat_root.rb_node; 79 ··· 83 session->stat_root = RB_ROOT; 84 } 85 86 static void destroy_session(struct stat_session *session) 87 { 88 debugfs_remove(session->file); 89 - reset_stat_session(session); 90 mutex_destroy(&session->stat_mutex); 91 kfree(session); 92 } ··· 157 int i; 158 159 mutex_lock(&session->stat_mutex); 160 - reset_stat_session(session); 161 162 if (!ts->stat_cmp) 163 ts->stat_cmp = dummy_cmp; ··· 190 return ret; 191 192 exit_free_rbtree: 193 - reset_stat_session(session); 194 mutex_unlock(&session->stat_mutex); 195 return ret; 196 } ··· 257 static int tracing_stat_open(struct inode *inode, struct file *file) 258 { 259 int ret; 260 - 261 struct stat_session *session = inode->i_private; 262 263 ret = seq_open(file, &trace_stat_seq_ops); 264 - if (!ret) { 265 - struct seq_file *m = file->private_data; 266 - m->private = session; 267 - ret = stat_seq_init(session); 268 } 269 270 return ret; 271 } 272 ··· 282 { 283 struct stat_session *session = i->i_private; 284 285 - mutex_lock(&session->stat_mutex); 286 reset_stat_session(session); 287 - mutex_unlock(&session->stat_mutex); 288 289 - return 0; 290 } 291 292 static const struct file_operations tracing_stat_fops = {
··· 73 } 74 } 75 76 + static void __reset_stat_session(struct stat_session *session) 77 { 78 struct rb_node *node = session->stat_root.rb_node; 79 ··· 83 session->stat_root = RB_ROOT; 84 } 85 86 + static void reset_stat_session(struct stat_session *session) 87 + { 88 + mutex_lock(&session->stat_mutex); 89 + __reset_stat_session(session); 90 + mutex_unlock(&session->stat_mutex); 91 + } 92 + 93 static void destroy_session(struct stat_session *session) 94 { 95 debugfs_remove(session->file); 96 + __reset_stat_session(session); 97 mutex_destroy(&session->stat_mutex); 98 kfree(session); 99 } ··· 150 int i; 151 152 mutex_lock(&session->stat_mutex); 153 + __reset_stat_session(session); 154 155 if (!ts->stat_cmp) 156 ts->stat_cmp = dummy_cmp; ··· 183 return ret; 184 185 exit_free_rbtree: 186 + __reset_stat_session(session); 187 mutex_unlock(&session->stat_mutex); 188 return ret; 189 } ··· 250 static int tracing_stat_open(struct inode *inode, struct file *file) 251 { 252 int ret; 253 + struct seq_file *m; 254 struct stat_session *session = inode->i_private; 255 256 + ret = stat_seq_init(session); 257 + if (ret) 258 + return ret; 259 + 260 ret = seq_open(file, &trace_stat_seq_ops); 261 + if (ret) { 262 + reset_stat_session(session); 263 + return ret; 264 } 265 266 + m = file->private_data; 267 + m->private = session; 268 return ret; 269 } 270 ··· 270 { 271 struct stat_session *session = i->i_private; 272 273 reset_stat_session(session); 274 275 + return seq_release(i, f); 276 } 277 278 static const struct file_operations tracing_stat_fops = {