-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
-
3
-
9223372036854775807
cYAML_get_object_item() searches recursively. It walks into the children of
the parent node, then into the parent's siblings through cy_next. A caller
that wants only a match under one parent can get a match from a later
sibling instead.
LU-20479 fixed one instance of this shape in cYAML_build_error(). Gerrit
review on change 67235 found a second instance during the fix.
handle_yaml_config_ni() in lnet/utils/lnetconfig/liblnetconfig.c walks a
sequence of local NI entries:
while (cYAML_get_next_seq_item(local_nis, &local_ni) != NULL) {
intf = cYAML_get_object_item(local_ni, "interfaces");
if (intf == NULL)
continue;
A parsed sequence item has cy_string set to NULL. When one local NI entry
has no "interfaces" key, the recursive search does not stop at that entry.
It falls through to the next sibling entry and returns that entry's
"interfaces" node instead. The "continue" statement only fires on the last
entry in the sequence, because only the last entry has no following
sibling to fall through to.
Audit the other cYAML_get_object_item() callers that predate commit
c906ab9c88ef ("LU-7734 lnet: configuration fixes") for the same hazard.
For each caller, confirm the recursive search is safe in that context.
If it is not safe, replace the call with cYAML_get_object_child(), which
searches only the given parent's direct children.