UCM: Disallow gets of undefined system properties In UCM, there are various system-defined properties whose names start with "_". Explicitly prevent any gets from falling back to properties defined in a config file if the property name starts with "_", in order to reserve the entire "_" namespace for system-defined properties. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/src/ucm/main.c b/src/ucm/main.c index e5d06e6..d319160 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c
@@ -1032,6 +1032,8 @@ err = get_device_list(uc_mgr, list, str); else if (check_identifier(identifier, "_modifiers")) err = get_modifier_list(uc_mgr, list, str); + else if (identifier[0] == '_') + err = -ENOENT; else err = get_value_list(uc_mgr, identifier, list, str); if (str) @@ -1159,6 +1161,9 @@ goto __end; } err = 0; + } else if (identifier[0] == '_') { + err = -ENOENT; + goto __end; } else { str1 = strchr(identifier, '/'); if (str1) { @@ -1247,8 +1252,16 @@ *value = err; err = 0; } +#if 0 + /* + * enable this block if the else clause below is expanded to query + * user-supplied values + */ + } else if (identifier[0] == '_') + err = -ENOENT; +#endif } else - err = -EINVAL; + err = -ENOENT; if (str) free(str); }