mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
tracefs updates for v7.3:
- Define event fields before directory creation Move the event_define_fields() call in event_create_dir() before the eventfs directory creation. Previously, a failure after directory creation wouldn't clean up eventfs_inode because the error path didn't call eventfs_remove_dir(). This eliminates the need to clean up the eventfs directories if event_define_fields() fails. - Add warning for out of bounds pos in __eventfs_iterate() Sashiko complains about the ctx->pos causing issues if it is less than 2 or greater than MAX_INT in __eventfs_iterate(). The thing is, the logic prevents that from happening. But to make Sashiko happy, add a WARN_ON() and exit safely if the function ever does get input that is out of the range the function expects. -----BEGIN PGP SIGNATURE----- iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCan+ZvBQccm9zdGVkdEBn b29kbWlzLm9yZwAKCRAp5XQQmuv6qtTfAQC+70AlkM07/RxLkS6GYEEoJ1orM/CO eheyYNZvdjovogEAoUjt0VO+PEcqKDkIdCpx3l9M4hu+B7hN51S2gdEz8gE= =EqMA -----END PGP SIGNATURE----- Merge tag 'tracefs-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace Pull tracefs updates from Steven Rostedt: - Define event fields before directory creation Move the event_define_fields() call in event_create_dir() before the eventfs directory creation. Previously, a failure after directory creation wouldn't clean up eventfs_inode because the error path didn't call eventfs_remove_dir(). This eliminates the need to clean up the eventfs directories if event_define_fields() fails. - Add warning for out of bounds pos in __eventfs_iterate() Sashiko complains about the ctx->pos causing issues if it is less than 2 or greater than MAX_INT in __eventfs_iterate(). The thing is, the logic prevents that from happening. But to make Sashiko happy, add a WARN_ON() and exit safely if the function ever does get input that is out of the range the function expects. * tag 'tracefs-v7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: eventfs: Add warning for out of bounds pos in __eventfs_iterate() eventfs: Define event fields before directory creation
This commit is contained in:
commit
1484625c59
|
|
@ -594,6 +594,10 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
|
|||
if (!(ti->flags & TRACEFS_EVENT_INODE))
|
||||
return -EINVAL;
|
||||
|
||||
/* Logic should prevent ctx->pos from going out of range */
|
||||
if (WARN_ON_ONCE(ctx->pos < 2 || ctx->pos > 0x7fffffffULL))
|
||||
return -EINVAL;
|
||||
|
||||
c = ctx->pos - 2;
|
||||
|
||||
guard(srcu)(&eventfs_srcu);
|
||||
|
|
|
|||
|
|
@ -3296,6 +3296,13 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
|
|||
if (WARN_ON_ONCE(strcmp(call->class->system, TRACE_SYSTEM) == 0))
|
||||
return -ENODEV;
|
||||
|
||||
ret = event_define_fields(call);
|
||||
if (ret < 0) {
|
||||
pr_warn("Could not initialize trace point events/%s\n",
|
||||
trace_event_name(call));
|
||||
return ret;
|
||||
}
|
||||
|
||||
e_events = event_subsystem_dir(tr, call->class->system, file, parent);
|
||||
if (!e_events)
|
||||
return -ENOMEM;
|
||||
|
|
@ -3314,12 +3321,6 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
|
|||
|
||||
file->ei = ei;
|
||||
|
||||
ret = event_define_fields(call);
|
||||
if (ret < 0) {
|
||||
pr_warn("Could not initialize trace point events/%s\n", name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Gets decremented on freeing of the "enable" file */
|
||||
event_file_get(file);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user