The following changes were made to adapt kdbus driver to 5.4 kernel
- use KERNEL_DS instead of get_ds()
- remove ITER_KVEC flag
- remove 'type' argument from access_ok()
- use memfd_fcntl() instead of shmem_get_seals()
- use uapi/linux/mount.h
Fixes:
736706bee329 ("get rid of legacy 'get_ds()' function")
Fixes:
aa563d7bca6e ("iov_iter: Separate type from direction and use accessor functions")
Fixes:
96d4f267e40f ("Remove 'type' argument from access_ok() function")
Fixes:
5aadc431a593 ("shmem: rename functions that are memfd-related")
Fixes:
5d752600a8c3 ("mm: restructure memfd code")
Fixes:
e262e32d6bde ("vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
Change-Id: I8d2b3db1c83bb21114554ba9eb38e5e439f5c141
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
#include <linux/ipc_namespace.h>
#include <linux/magic.h>
#include <linux/module.h>
-#include <linux/mount.h>
+#include <uapi/linux/mount.h>
#include <linux/mutex.h>
#include <linux/namei.h>
#include <linux/pagemap.h>
#include <linux/cred.h>
#include <linux/file.h>
#include <linux/init.h>
+#include <linux/memfd.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sched.h>
-#include <linux/shmem_fs.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
if (!f)
return ERR_PTR(-EBADF);
- s = shmem_get_seals(f);
+ s = memfd_fcntl(f, F_GET_SEALS, 0);
if (s < 0)
ret = ERR_PTR(-EMEDIUMTYPE);
else if ((s & m) != m)
return -EMSGSIZE;
if (vec_size + size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE)
return -EMSGSIZE;
- if (ptr && unlikely(!access_ok(VERIFY_READ, ptr, size)))
+ if (ptr && unlikely(!access_ok(ptr, size)))
return -EFAULT;
if (ptr || size % 8) /* data or padding */
return -EFAULT;
off += slice->off;
- iov_iter_kvec(&iter, WRITE | ITER_KVEC, kvec, kvec_len, total_len);
+ iov_iter_kvec(&iter, WRITE, kvec, kvec_len, total_len);
old_fs = get_fs();
- set_fs(get_ds());
+ set_fs(KERNEL_DS);
len = vfs_iter_write(slice->pool->f, &iter, &off, 0);
set_fs(old_fs);
inode_lock(i_dst);
old_fs = get_fs();
- set_fs(get_ds());
+ set_fs(KERNEL_DS);
while (len > 0) {
unsigned long page_off;
unsigned long copy_len;