Skip to content

Commit a3928f8

Browse files
mhiramatrostedt
authored andcommitted
tracing/boot: Fix trace_boot_hist_add_array() to check array is value
trace_boot_hist_add_array() uses the combination of xbc_node_find_child() and xbc_node_get_child() to get the child node of the key node. But since it missed to check the child node is data node or not, user can pass the subkey node for the array node (anode). To avoid this issue, check the array node is a data node. Actually, there is xbc_node_find_value(node, key, vnode), which ensures the @vnode is a value node, so use it in trace_boot_hist_add_array() to fix this issue. Link: https://lkml.kernel.org/r/163119458308.161018.1516455973625940212.stgit@devnote2 Fixes: e66ed86 ("tracing/boot: Add per-event histogram action options") Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent cfd7998 commit a3928f8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

kernel/trace/trace_boot.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,12 @@ static int __init
219219
trace_boot_hist_add_array(struct xbc_node *hnode, char **bufp,
220220
char *end, const char *key)
221221
{
222-
struct xbc_node *knode, *anode;
222+
struct xbc_node *anode;
223223
const char *p;
224224
char sep;
225225

226-
knode = xbc_node_find_child(hnode, key);
227-
if (knode) {
228-
anode = xbc_node_get_child(knode);
226+
p = xbc_node_find_value(hnode, key, &anode);
227+
if (p) {
229228
if (!anode) {
230229
pr_err("hist.%s requires value(s).\n", key);
231230
return -EINVAL;

0 commit comments

Comments
 (0)