diff options
Diffstat (limited to 'kernel/trace/trace_probe.c')
-rw-r--r-- | kernel/trace/trace_probe.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 89da34b326e3..8f8411e7835f 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | #include "trace_probe.h" | 14 | #include "trace_probe.h" |
15 | 15 | ||
16 | const char *reserved_field_names[] = { | 16 | static const char *reserved_field_names[] = { |
17 | "common_type", | 17 | "common_type", |
18 | "common_flags", | 18 | "common_flags", |
19 | "common_preempt_count", | 19 | "common_preempt_count", |
@@ -159,6 +159,7 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup, | |||
159 | char *buf) | 159 | char *buf) |
160 | { | 160 | { |
161 | const char *slash, *event = *pevent; | 161 | const char *slash, *event = *pevent; |
162 | int len; | ||
162 | 163 | ||
163 | slash = strchr(event, '/'); | 164 | slash = strchr(event, '/'); |
164 | if (slash) { | 165 | if (slash) { |
@@ -171,12 +172,25 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup, | |||
171 | return -E2BIG; | 172 | return -E2BIG; |
172 | } | 173 | } |
173 | strlcpy(buf, event, slash - event + 1); | 174 | strlcpy(buf, event, slash - event + 1); |
175 | if (!is_good_name(buf)) { | ||
176 | pr_info("Group name must follow the same rules as C identifiers\n"); | ||
177 | return -EINVAL; | ||
178 | } | ||
174 | *pgroup = buf; | 179 | *pgroup = buf; |
175 | *pevent = slash + 1; | 180 | *pevent = slash + 1; |
181 | event = *pevent; | ||
176 | } | 182 | } |
177 | if (strlen(event) == 0) { | 183 | len = strlen(event); |
184 | if (len == 0) { | ||
178 | pr_info("Event name is not specified\n"); | 185 | pr_info("Event name is not specified\n"); |
179 | return -EINVAL; | 186 | return -EINVAL; |
187 | } else if (len > MAX_EVENT_NAME_LEN) { | ||
188 | pr_info("Event name is too long\n"); | ||
189 | return -E2BIG; | ||
190 | } | ||
191 | if (!is_good_name(event)) { | ||
192 | pr_info("Event name must follow the same rules as C identifiers\n"); | ||
193 | return -EINVAL; | ||
180 | } | 194 | } |
181 | return 0; | 195 | return 0; |
182 | } | 196 | } |
@@ -548,6 +562,8 @@ int traceprobe_parse_probe_arg(struct trace_probe *tp, int i, char *arg, | |||
548 | 562 | ||
549 | body = strchr(arg, '='); | 563 | body = strchr(arg, '='); |
550 | if (body) { | 564 | if (body) { |
565 | if (body - arg > MAX_ARG_NAME_LEN || body == arg) | ||
566 | return -EINVAL; | ||
551 | parg->name = kmemdup_nul(arg, body - arg, GFP_KERNEL); | 567 | parg->name = kmemdup_nul(arg, body - arg, GFP_KERNEL); |
552 | body++; | 568 | body++; |
553 | } else { | 569 | } else { |