Fix a bug about socket exsitence check 23/266223/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 9 Nov 2021 08:06:27 +0000 (17:06 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 9 Nov 2021 08:06:27 +0000 (17:06 +0900)
When getting app startup signal from a child process of launchpad, AMD
tries to connect to the app socket. When calling the aul_initialize() function,
the application sends the APP_NOTIFY_START request to AMD.
While handling the APP_NOTIFY_START command, AMD sets the flag that is
socket_exists of the app status handle.
After this patch is applied, AMD checks whether the socket exists or not
before sending the app request to the application.

Change-Id: I6974e8684f6b5fec3adc0e4fcd63ec4946f14866
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_app_request_broker.cc
src/lib/amd_launch.c

index e05e1af2111af770ab914630e077a9c2ec7d9bb2..8732a7da5d34c715b8af4839d64e038e7f9bd42d 100644 (file)
@@ -30,7 +30,6 @@
 #include <bundle_cpp.h>
 #include <parcel.hh>
 
-#include "lib/amd_app_status.h"
 #include "lib/amd_util.h"
 #include "lib/socket/client_socket.hh"
 
@@ -271,13 +270,6 @@ int _app_request_broker_send(app_request_t* request,
   auto& broker = AppRequestBroker::GetInst();
   auto channel = broker.FindClientChannel(request->pid);
   if (channel == nullptr) {
-    app_status_h app_status = _app_status_find(request->pid);
-    if (app_status == nullptr)
-      return -EINVAL;
-
-    if (!_app_status_socket_exists(app_status))
-      return -ECOMM;
-
     channel = broker.CreateClientChannel(request->pid, request->uid);
     if (channel == nullptr)
       return -ECOMM;
index d5f56f04bd68749b0f71dcec1e24063acc53e1c8..5bb61653829c4fc8452f0947ba7e0e1ff77b19a9 100644 (file)
@@ -497,6 +497,9 @@ static int __send_app_request(pid_t pid, uid_t uid, int cmd, int clifd,
                .data = data
        };
 
+       if (!_app_status_socket_exists(_app_status_find(pid)))
+               return -ECOMM;
+
        info = __create_reply_info(pid, uid, cmd, clifd, data);
        if (!info)
                return -ENOMEM;