mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	tracing/probe: Check event/group naming rule at parsing
Check event and group naming rule at parsing it instead of allocating probes. Link: http://lkml.kernel.org/r/155253784064.14922.2336893061156236237.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									b4443c17a3
								
							
						
					
					
						commit
						5b7a962209
					
				
					 3 changed files with 10 additions and 10 deletions
				
			
		|  | @ -221,7 +221,7 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group, | ||||||
| 
 | 
 | ||||||
| 	tk->rp.maxactive = maxactive; | 	tk->rp.maxactive = maxactive; | ||||||
| 
 | 
 | ||||||
| 	if (!event || !is_good_name(event)) { | 	if (!event || !group) { | ||||||
| 		ret = -EINVAL; | 		ret = -EINVAL; | ||||||
| 		goto error; | 		goto error; | ||||||
| 	} | 	} | ||||||
|  | @ -231,11 +231,6 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group, | ||||||
| 	if (!tk->tp.call.name) | 	if (!tk->tp.call.name) | ||||||
| 		goto error; | 		goto error; | ||||||
| 
 | 
 | ||||||
| 	if (!group || !is_good_name(group)) { |  | ||||||
| 		ret = -EINVAL; |  | ||||||
| 		goto error; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	tk->tp.class.system = kstrdup(group, GFP_KERNEL); | 	tk->tp.class.system = kstrdup(group, GFP_KERNEL); | ||||||
| 	if (!tk->tp.class.system) | 	if (!tk->tp.class.system) | ||||||
| 		goto error; | 		goto error; | ||||||
|  |  | ||||||
|  | @ -172,6 +172,10 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup, | ||||||
| 			return -E2BIG; | 			return -E2BIG; | ||||||
| 		} | 		} | ||||||
| 		strlcpy(buf, event, slash - event + 1); | 		strlcpy(buf, event, slash - event + 1); | ||||||
|  | 		if (!is_good_name(buf)) { | ||||||
|  | 			pr_info("Group name must follow the same rules as C identifiers\n"); | ||||||
|  | 			return -EINVAL; | ||||||
|  | 		} | ||||||
| 		*pgroup = buf; | 		*pgroup = buf; | ||||||
| 		*pevent = slash + 1; | 		*pevent = slash + 1; | ||||||
| 		event = *pevent; | 		event = *pevent; | ||||||
|  | @ -184,6 +188,10 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup, | ||||||
| 		pr_info("Event name is too long\n"); | 		pr_info("Event name is too long\n"); | ||||||
| 		return -E2BIG; | 		return -E2BIG; | ||||||
| 	} | 	} | ||||||
|  | 	if (!is_good_name(event)) { | ||||||
|  | 		pr_info("Event name must follow the same rules as C identifiers\n"); | ||||||
|  | 		return -EINVAL; | ||||||
|  | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -266,10 +266,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) | ||||||
| { | { | ||||||
| 	struct trace_uprobe *tu; | 	struct trace_uprobe *tu; | ||||||
| 
 | 
 | ||||||
| 	if (!event || !is_good_name(event)) | 	if (!event || !group) | ||||||
| 		return ERR_PTR(-EINVAL); |  | ||||||
| 
 |  | ||||||
| 	if (!group || !is_good_name(group)) |  | ||||||
| 		return ERR_PTR(-EINVAL); | 		return ERR_PTR(-EINVAL); | ||||||
| 
 | 
 | ||||||
| 	tu = kzalloc(SIZEOF_TRACE_UPROBE(nargs), GFP_KERNEL); | 	tu = kzalloc(SIZEOF_TRACE_UPROBE(nargs), GFP_KERNEL); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Masami Hiramatsu
						Masami Hiramatsu