History

Merge tag 'trace-v5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt: "Tracing, ftrace and tracefs fixes: - Have tracefs honor the gid mount option - Have new files in tracefs inherit the parent ownership - Have direct_ops unregister when it has no more functions - Properly clean up the ops when unregistering multi direct ops - Add a sample module to test the multiple direct ops - Fix memory leak in error path of __create_synth_event()" * tag 'trace-v5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix possible memory leak in __create_synth_event() error path ftrace/samples: Add module to test multi direct modify interface ftrace: Add cleanup to unregister_ftrace_direct_multi ftrace: Use direct_ops hash in unregister_ftrace_direct tracefs: Set all files to the same group ownership as the mount option tracefs: Have new files inherit the ownership of their parent

Linus Torvalds committed 4 years ago

Commit 257dcf22 parents 0d21e66 c24be245 files · +242 −6Browse files

Showing the changes to kernel (2 of 5 files). Show all

Unified · Split

2 files
  1. kernel/trace/ftrace.c +7 −1
  2. kernel/trace/trace_events_synth.c +6 −5
kernel/trace/ftrace.c+7−1
@@ -5217,6 +5217,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 5216 unmodified lines
5217{5217{
5218 struct ftrace_direct_func *direct;5218 struct ftrace_direct_func *direct;
5219 struct ftrace_func_entry *entry;5219 struct ftrace_func_entry *entry;
5220 struct ftrace_hash *hash;
5220 int ret = -ENODEV;5221 int ret = -ENODEV;
5221 5222
5222 mutex_lock(&direct_mutex);5223 mutex_lock(&direct_mutex);
@@ -5225,7 +5226,8 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 2 unmodified lines
5225 if (!entry)5226 if (!entry)
5226 goto out_unlock;5227 goto out_unlock;
5227 5228
5228 if (direct_functions->count == 1)5229 hash = direct_ops.func_hash->filter_hash;
5230 if (hash->count == 1)
5229 unregister_ftrace_function(&direct_ops);5231 unregister_ftrace_function(&direct_ops);
5230 5232
5231 ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0);5233 ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0);
@@ -5540,6 +5542,10 @@ int unregister_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr) · 308 unmodified lines
5540 err = unregister_ftrace_function(ops);5542 err = unregister_ftrace_function(ops);
5541 remove_direct_functions_hash(hash, addr);5543 remove_direct_functions_hash(hash, addr);
5542 mutex_unlock(&direct_mutex);5544 mutex_unlock(&direct_mutex);
5545
5546 /* cleanup for possible another register call */
5547 ops->func = NULL;
5548 ops->trampoline = 0;
5543 return err;5549 return err;
5544}5550}
5545EXPORT_SYMBOL_GPL(unregister_ftrace_direct_multi);5551EXPORT_SYMBOL_GPL(unregister_ftrace_direct_multi);
kernel/trace/trace_events_synth.c+6−5
@@ -1237,9 +1237,8 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 1236 unmodified lines
1237 argv + consumed, &consumed,1237 argv + consumed, &consumed,
1238 &field_version);1238 &field_version);
1239 if (IS_ERR(field)) {1239 if (IS_ERR(field)) {
1240 argv_free(argv);
1241 ret = PTR_ERR(field);1240 ret = PTR_ERR(field);
1242 goto err;1241 goto err_free_arg;
1243 }1242 }
1244 1243
1245 /*1244 /*
@@ -1262,18 +1261,19 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 16 unmodified lines
1262 if (cmd_version > 1 && n_fields_this_loop >= 1) {1261 if (cmd_version > 1 && n_fields_this_loop >= 1) {
1263 synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str));1262 synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str));
1264 ret = -EINVAL;1263 ret = -EINVAL;
1265 goto err;1264 goto err_free_arg;
1266 }1265 }
1267 1266
1268 fields[n_fields++] = field;1267 fields[n_fields++] = field;
1269 if (n_fields == SYNTH_FIELDS_MAX) {1268 if (n_fields == SYNTH_FIELDS_MAX) {
1270 synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0);1269 synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0);
1271 ret = -EINVAL;1270 ret = -EINVAL;
1272 goto err;1271 goto err_free_arg;
1273 }1272 }
1274 1273
1275 n_fields_this_loop++;1274 n_fields_this_loop++;
1276 }1275 }
1276 argv_free(argv);
1277 1277
1278 if (consumed < argc) {1278 if (consumed < argc) {
1279 synth_err(SYNTH_ERR_INVALID_CMD, 0);1279 synth_err(SYNTH_ERR_INVALID_CMD, 0);
@@ -1281,7 +1281,6 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 1 unmodified line
1281 goto err;1281 goto err;
1282 }1282 }
1283 1283
1284 argv_free(argv);
1285 }1284 }
1286 1285
1287 if (n_fields == 0) {1286 if (n_fields == 0) {
@@ -1307,6 +1306,8 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 19 unmodified lines
1307 kfree(saved_fields);1306 kfree(saved_fields);
1308 1307
1309 return ret;1308 return ret;
1309 err_free_arg:
1310 argv_free(argv);
1310 err:1311 err:
1311 for (i = 0; i < n_fields; i++)1312 for (i = 0; i < n_fields; i++)
1312 free_synth_field(fields[i]);1313 free_synth_field(fields[i]);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t