mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
tracing/synthetic: Free pending field on error path
Some __create_synth_event() error paths run after parse_synth_field() succeeds but before the field is stored in fields[]. The common cleanup then misses the field. Free it before freeing argv. Link: https://patch.msgid.link/20260603062533.1096320-1-pengyu@kylinos.cn Signed-off-by: Yu Peng <pengyu@kylinos.cn> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
@@ -1446,13 +1446,13 @@ static int __create_synth_event(const char *name, const char *raw_fields)
|
||||
if (cmd_version > 1 && n_fields_this_loop >= 1) {
|
||||
synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str));
|
||||
ret = -EINVAL;
|
||||
goto err_free_arg;
|
||||
goto err_free_field;
|
||||
}
|
||||
|
||||
if (n_fields == SYNTH_FIELDS_MAX) {
|
||||
synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0);
|
||||
ret = -EINVAL;
|
||||
goto err_free_arg;
|
||||
goto err_free_field;
|
||||
}
|
||||
fields[n_fields++] = field;
|
||||
|
||||
@@ -1491,6 +1491,8 @@ static int __create_synth_event(const char *name, const char *raw_fields)
|
||||
kfree(saved_fields);
|
||||
|
||||
return ret;
|
||||
err_free_field:
|
||||
free_synth_field(field);
|
||||
err_free_arg:
|
||||
argv_free(argv);
|
||||
err:
|
||||
|
||||
Reference in New Issue
Block a user