kdbus: Adjust for linux v4.14
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 8 Aug 2019 10:52:02 +0000 (12:52 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 8 Aug 2019 17:46:50 +0000 (19:46 +0200)
Change-Id: Ib04f90501a01ed820b499c11962a02798bdd8866

ipc/kdbus/bus.c
ipc/kdbus/domain.c
ipc/kdbus/domain.h
ipc/kdbus/endpoint.c
ipc/kdbus/fs.c
ipc/kdbus/metadata.c
ipc/kdbus/names.c
ipc/kdbus/policy.c
ipc/kdbus/pool.c
ipc/kdbus/util.h

index 9d0679eb59f6244ea0feebd617324362878251f4..e4645bf226e79a3281dcf640c7dc7eef1bda3773 100644 (file)
  * your option) any later version.
  */
 
+#include <linux/cred.h>
 #include <linux/fs.h>
 #include <linux/hashtable.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/random.h>
 #include <linux/sched.h>
+#include <linux/security.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
index ac9f760c150dd6c387e51ab3b6675dac947c4344..e2fdcde550ec0d803d3b018b6ba816bded793525 100644 (file)
@@ -12,6 +12,7 @@
  * your option) any later version.
  */
 
+#include <linux/cred.h>
 #include <linux/fs.h>
 #include <linux/idr.h>
 #include <linux/init.h>
index 447a2bd4d97255177b00e23b5ff648d49222f51f..41dba1f1a05c97d04040659fe46c56b334c14f0d 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/fs.h>
 #include <linux/idr.h>
 #include <linux/kref.h>
+#include <linux/security.h>
 #include <linux/user_namespace.h>
 
 #include "node.h"
index 174d274b113eae922aa213f652b6292d799908c7..4efe5213528a97d778093e434e7a56f74d6c575c 100644 (file)
@@ -12,6 +12,7 @@
  * your option) any later version.
  */
 
+#include <linux/cred.h>
 #include <linux/fs.h>
 #include <linux/idr.h>
 #include <linux/init.h>
index d01f33baaa0d9515b324a83ed9aeacfe7657615a..90344fae7fea9554e2f5d5da6fe5ee7f14670331 100644 (file)
@@ -11,6 +11,7 @@
  * your option) any later version.
  */
 
+#include <linux/cred.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
 #include <linux/fsnotify.h>
@@ -126,9 +127,9 @@ static loff_t fs_dir_fop_llseek(struct file *file, loff_t offset, int whence)
        loff_t ret;
 
        /* protect f_off against fop_iterate */
-       mutex_lock(&inode->i_mutex);
+       inode_lock(inode);
        ret = generic_file_llseek(file, offset, whence);
-       mutex_unlock(&inode->i_mutex);
+       inode_unlock(inode);
 
        return ret;
 }
@@ -203,7 +204,7 @@ static struct inode *fs_inode_get(struct super_block *sb,
        inode->i_private = kdbus_node_ref(node);
        inode->i_mapping->a_ops = &empty_aops;
        inode->i_mode = node->mode & S_IALLUGO;
-       inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+       inode->i_atime = inode->i_ctime = inode->i_mtime = current_time(inode);
        inode->i_uid = node->uid;
        inode->i_gid = node->gid;
 
@@ -280,8 +281,8 @@ static int fs_super_fill(struct super_block *sb)
        struct inode *inode;
        int ret;
 
-       sb->s_blocksize = PAGE_CACHE_SIZE;
-       sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
+       sb->s_blocksize = PAGE_SIZE;
+       sb->s_blocksize_bits = PAGE_SHIFT;
        sb->s_magic = KDBUS_SUPER_MAGIC;
        sb->s_maxbytes = MAX_LFS_FILESIZE;
        sb->s_op = &fs_super_sops;
index 3adc6c2c2e766be8cd25684dfca3394a3e75ea54..44f058d723aa27a5ed17ddd0f616134e37b4a1bf 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/kref.h>
 #include <linux/mutex.h>
 #include <linux/sched.h>
+#include <linux/sched/mm.h>
 #include <linux/security.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
@@ -260,7 +261,7 @@ static int kdbus_meta_proc_collect_auxgroups(struct kdbus_meta_proc *mp)
                }
 
                for (i = 0; i < info->ngroups; i++)
-                       mp->auxgrps[i] = GROUP_AT(info, i);
+                       mp->auxgrps[i] = info->gid[i];
        }
 
        mp->n_auxgrps = info->ngroups;
@@ -335,7 +336,7 @@ static int kdbus_meta_proc_collect_cgroup(struct kdbus_meta_proc *mp)
        void *page;
        char *s;
 
-       page = (void *)__get_free_page(GFP_TEMPORARY);
+       page = (void *)__get_free_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
 
@@ -861,7 +862,7 @@ int kdbus_meta_export_prepare(struct kdbus_meta_proc *mp,
                size += KDBUS_ITEM_SIZE(strlen(mp->pid_comm) + 1);
 
        if (mp && (*mask & KDBUS_ATTACH_EXE)) {
-               exe_page = (void *)__get_free_page(GFP_TEMPORARY);
+               exe_page = (void *)__get_free_page(GFP_KERNEL);
                if (!exe_page) {
                        ret = -ENOMEM;
                        goto exit;
@@ -1058,7 +1059,7 @@ int kdbus_meta_export(struct kdbus_meta_proc *mp,
 
                get_fs_root(current->fs, &p);
                if (path_equal(&p, &mp->root_path)) {
-                       exe_page = (void *)__get_free_page(GFP_TEMPORARY);
+                       exe_page = (void *)__get_free_page(GFP_KERNEL);
                        if (!exe_page) {
                                path_put(&p);
                                ret = -ENOMEM;
index df99e4df815b2e678ebc648bdf963b1940fdc56d..e6d53531ea341fc52adf14da9b8bc7bc39b98f15 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <linux/ctype.h>
+#include <linux/cred.h>
 #include <linux/fs.h>
 #include <linux/hash.h>
 #include <linux/idr.h>
index dd7fffaafa849126b058a6762d0787d2cad2cbd7..d43149a8dc8022050c64203a9a8469f4d54c8b40 100644 (file)
@@ -12,6 +12,7 @@
  * your option) any later version.
  */
 
+#include <linux/cred.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
 #include <linux/init.h>
@@ -83,7 +84,7 @@ static void kdbus_policy_entry_free(struct kdbus_policy_db_entry *e)
 
 static unsigned int kdbus_strnhash(const char *str, size_t len)
 {
-       unsigned long hash = init_name_hash();
+       unsigned long hash = init_name_hash(str);
 
        while (len--)
                hash = partial_name_hash(*str++, hash);
@@ -192,7 +193,7 @@ int kdbus_policy_query_unlocked(struct kdbus_policy_db *db,
                        }
 
                        for (i = 0; i < cred->group_info->ngroups; i++) {
-                               kgid_t gid = GROUP_AT(cred->group_info, i);
+                               kgid_t gid = cred->group_info->gid[i];
 
                                if (gid_eq(gid, a->gid)) {
                                        highest = a->access;
index 45dcdea505f4815ceb7d65d6e1b609d5218f8847..e5713a521da0fdbd299cd715d8b8bd7d14481a9e 100644 (file)
@@ -587,7 +587,7 @@ kdbus_pool_slice_copy_iovec(const struct kdbus_pool_slice *slice, loff_t off,
 
        off += slice->off;
        iov_iter_init(&iter, WRITE, iov, iov_len, total_len);
-       len = vfs_iter_write(slice->pool->f, &iter, &off);
+       len = vfs_iter_write(slice->pool->f, &iter, &off, 0);
 
        return (len >= 0 && len != total_len) ? -EFAULT : len;
 }
@@ -620,7 +620,7 @@ ssize_t kdbus_pool_slice_copy_kvec(const struct kdbus_pool_slice *slice,
 
        old_fs = get_fs();
        set_fs(get_ds());
-       len = vfs_iter_write(slice->pool->f, &iter, &off);
+       len = vfs_iter_write(slice->pool->f, &iter, &off, 0);
        set_fs(old_fs);
 
        return (len >= 0 && len != total_len) ? -EFAULT : len;
@@ -651,7 +651,7 @@ int kdbus_pool_slice_copy(const struct kdbus_pool_slice *slice_dst,
            WARN_ON(slice_src->free || slice_dst->free))
                return -EINVAL;
 
-       mutex_lock(&i_dst->i_mutex);
+       inode_lock(i_dst);
        old_fs = get_fs();
        set_fs(get_ds());
        while (len > 0) {
@@ -663,9 +663,9 @@ int kdbus_pool_slice_copy(const struct kdbus_pool_slice *slice_dst,
                void *fsdata;
                long status;
 
-               page_off = off_dst & (PAGE_CACHE_SIZE - 1);
+               page_off = off_dst & (PAGE_SIZE - 1);
                copy_len = min_t(unsigned long,
-                                PAGE_CACHE_SIZE - page_off, len);
+                                PAGE_SIZE - page_off, len);
 
                status = aops->write_begin(f_dst, mapping_dst, off_dst,
                                           copy_len, 0, &page, &fsdata);
@@ -696,7 +696,7 @@ int kdbus_pool_slice_copy(const struct kdbus_pool_slice *slice_dst,
                len -= copy_len;
        }
        set_fs(old_fs);
-       mutex_unlock(&i_dst->i_mutex);
+       inode_unlock(i_dst);
 
        return ret;
 }
index 740b198809853e5391c29bd94725ac9f62191ff7..345578616acb2ef7cebaf894856895c014128f8c 100644 (file)
@@ -51,7 +51,7 @@
  */
 static inline unsigned int kdbus_strhash(const char *str)
 {
-       unsigned long hash = init_name_hash();
+       unsigned long hash = init_name_hash(str);
 
        while (*str)
                hash = partial_name_hash(*str++, hash);