Fix invalid access 25/257425/1
authorHwankyu Jhun <h.jhun@samsung.com>
Sun, 25 Apr 2021 23:46:31 +0000 (08:46 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Sun, 25 Apr 2021 23:46:31 +0000 (08:46 +0900)
When calling __remove_proc_info(), the allocated memory is released.
Before calling __remove_proc_info(), AMD sets the cmd variable to avoid
invalid access.

Change-Id: I16aa97d80b8cd63440033fa1d5137c4a9b5d5c65
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_anr_monitor.c

index fa6a1d17e73af31fcee7f5dbdca17c09d1437e3c..bc342d08a8ba71142a61e3fce17a0f75f58aa4e0 100644 (file)
@@ -104,12 +104,14 @@ static gboolean __timeout_handler(gpointer data)
        pid_t pid = GPOINTER_TO_INT(data);
        app_status_h app_status;
        proc_info_t *ctx;
+       int cmd;
 
        ctx = __find_proc_info(pid);
        if (!ctx)
                return G_SOURCE_REMOVE;
 
        ctx->timer = 0;
+       cmd = ctx->cmd;
        __remove_proc_info(pid);
 
        app_status = _app_status_find_v2(pid);
@@ -123,7 +125,7 @@ static gboolean __timeout_handler(gpointer data)
                return G_SOURCE_REMOVE;
        }
 
-       _W("Application(%d) Not Responding. cmd(%d)", pid, ctx->cmd);
+       _W("Application(%d) Not Responding. cmd(%d)", pid, cmd);
        if (__can_ignore_anr_policy(app_status)) {
                _W("Ignore ANR policy. pid(%d)", pid);
                return G_SOURCE_REMOVE;