From 5350352762061a6cf1210bfef5e129e097249405 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 23 Sep 2022 11:09:02 +0900 Subject: [PATCH] pmqos: Fix to return proper value for dbus signal handler From the dbus-stub generated code, signal handler should return TRUE if it handles invocation. Even ret value is error, fix to return TRUE after handling invocation. Below is dbus-stub comment about signal handler: If a signal handler returns %TRUE, it means the signal handler will handle the invocation and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run. NOTE: GLIB related asan heap-buffer-overflow issue is from the wrong return. Change-Id: I070c4a3fd12d5421cc52e69e6ada25b2ec772e6f Suggested-by: Sangjung Woo Signed-off-by: Seung-Woo Kim --- src/pmqos/pmqos.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index 91476c6..20fd04a 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -117,7 +117,7 @@ static gboolean dbus_cb_pmqos_start(SystemPassPmqos *obj, _E("failed to initialize PASS PMQoS of the daemon " "in dbus callback for a start message\n"); - return FALSE; + return TRUE; } /** @@ -159,11 +159,9 @@ static gboolean dbus_cb_pmqos_set_scenario(SystemPassPmqos *obj, { int i, ret = -ENOTSUP; int max_duration_ms = -1; - gboolean ret_out = TRUE; if (!g_pmqos) { _E("PASS PMQoS is stopped\n"); - ret_out = FALSE; goto out; } @@ -181,7 +179,6 @@ static gboolean dbus_cb_pmqos_set_scenario(SystemPassPmqos *obj, if (ret < 0) { _E("cannot set the PMQoS scenario: " "%s is not supported\n", name); - ret_out = FALSE; goto out_dbus; } @@ -208,7 +205,7 @@ static gboolean dbus_cb_pmqos_set_scenario(SystemPassPmqos *obj, out_dbus: g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret)); out: - return ret_out; + return TRUE; } /** @@ -229,7 +226,7 @@ static gboolean dbus_cb_pmqos_legacy_scenario(SystemPassPmqos *obj, if (!g_pmqos) { _E("PASS PMQoS is stopped\n"); - return FALSE; + return TRUE; } name = g_dbus_method_invocation_get_method_name(invoc); -- 2.7.4