kdbus: porting to 4.14
[platform/kernel/linux-rpi.git] / ipc / kdbus / metadata.c
index 106ec26..2f93d60 100644 (file)
@@ -262,15 +262,13 @@ static int kdbus_meta_proc_collect_cgroup(struct kdbus_meta_proc *mp)
 {
 #ifdef CONFIG_CGROUPS
        void *page;
-       char *s;
 
-       page = (void *)__get_free_page(GFP_TEMPORARY);
+       page = (void *)__get_free_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
 
-       s = task_cgroup_path(current, page, PAGE_SIZE);
-       if (s) {
-               mp->cgroup = kstrdup(s, GFP_KERNEL);
+       if (task_cgroup_path(current, page, PAGE_SIZE) < PAGE_SIZE) {
+               mp->cgroup = kstrdup(page, GFP_KERNEL);
                if (!mp->cgroup) {
                        free_page((unsigned long)page);
                        return -ENOMEM;
@@ -965,8 +963,7 @@ static size_t kdbus_meta_write(struct kdbus_meta_staging *staging, void *mem,
                item = kdbus_write_head(&items, KDBUS_ITEM_AUXGROUPS,
                                        info->ngroups * sizeof(u64));
                for (i = 0; i < info->ngroups; ++i)
-                       item->data64[i] = from_kgid_munged(user_ns,
-                                                          GROUP_AT(info, i));
+                       item->data64[i] = from_kgid_munged(user_ns, info->gid[i]);
        }
 
        if (staging->mp && (staging->mask & KDBUS_ATTACH_TID_COMM))
@@ -1113,7 +1110,7 @@ int kdbus_meta_emit(struct kdbus_meta_proc *mp,
 
                get_fs_root(current->fs, &p);
                if (path_equal(&p, &conn->root_path)) {
-                       staging.exe = (void *)__get_free_page(GFP_TEMPORARY);
+                       staging.exe = (void *)__get_free_page(GFP_KERNEL);
                        if (!staging.exe) {
                                path_put(&p);
                                ret = -ENOMEM;