Fix crash issue of calling disable pkgs from storaged 33/158633/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 2 Nov 2017 07:41:11 +0000 (16:41 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 2 Nov 2017 07:41:11 +0000 (16:41 +0900)
Currently, storaged calls app2sd api which is synchronous when sdcard
being umounted. Then, app2sd-server calls storage_get_primary_sdcard()
which requests sdcard information to storaged synchronously. This causes
deadlock and storaged gets SIGABRT. However, app2sd-server doesn't need
to call storage_get_primary_sdcard() at current implementaion.

Change-Id: I6a005e6cc7d343929dfbfb8c77264609d457fe23
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
plugin/app2sd/server/app2sd_interface.c

index c4821f3..8e97a20 100644 (file)
@@ -509,12 +509,14 @@ static int _app2sd_kill_running_app(const char *pkgid, uid_t uid)
 int app2sd_usr_on_demand_setup_exit(const char *pkgid, uid_t uid)
 {
        int ret;
-       char mmc_path[FILENAME_MAX];
        char application_path[FILENAME_MAX];
        char loopback_device[FILENAME_MAX];
+#ifndef TIZEN_FEATURE_APP2SD_DMCRYPT_ENCRYPTION
+       char mmc_path[FILENAME_MAX];
        char *sdpath;
        FILE *fp;
        int mmc_present = 1;
+#endif
 
        /* validate the function parameter recieved */
        if (pkgid == NULL) {
@@ -524,6 +526,10 @@ int app2sd_usr_on_demand_setup_exit(const char *pkgid, uid_t uid)
 
        _app2sd_kill_running_app(pkgid, uid);
 
+       _app2sd_set_application_path(pkgid, uid, application_path,
+                       sizeof(application_path));
+
+#ifndef TIZEN_FEATURE_APP2SD_DMCRYPT_ENCRYPTION
        /* check whether MMC is present or not */
        ret = _app2sd_check_mmc_status(&sdpath);
        if (ret) {
@@ -538,9 +544,6 @@ int app2sd_usr_on_demand_setup_exit(const char *pkgid, uid_t uid)
        if (ret)
                return ret;
 
-       _app2sd_set_application_path(pkgid, uid, application_path,
-                       sizeof(application_path));
-
        if (mmc_present) {
                fp = fopen(loopback_device, "r+");
                if (fp == NULL) {
@@ -549,6 +552,7 @@ int app2sd_usr_on_demand_setup_exit(const char *pkgid, uid_t uid)
                }
                fclose(fp);
        }
+#endif
 
        ret = __app2sd_finalize_device_setup(pkgid, loopback_device,
                        application_path, uid);