From: Łukasz Stelmach Date: Mon, 21 Dec 2020 15:34:08 +0000 (+0100) Subject: kdbus: porting to to 5.4 X-Git-Tag: accepted/tizen/unified/20210330.111217~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d382bf3f35341b7c75783994d9983fbd03badb89;p=platform%2Fkernel%2Flinux-rpi.git kdbus: porting to to 5.4 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 --- diff --git a/ipc/kdbus/fs.c b/ipc/kdbus/fs.c index e368b73..3e74111 100644 --- a/ipc/kdbus/fs.c +++ b/ipc/kdbus/fs.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c index 8aef83d..63626c8 100644 --- a/ipc/kdbus/message.c +++ b/ipc/kdbus/message.c @@ -17,10 +17,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -263,7 +263,7 @@ static struct file *kdbus_get_memfd(const struct kdbus_memfd *memfd) 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) @@ -346,7 +346,7 @@ static int kdbus_msg_examine(struct kdbus_msg *msg, struct kdbus_bus *bus, 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 */ diff --git a/ipc/kdbus/pool.c b/ipc/kdbus/pool.c index fb1a88a..b128963 100644 --- a/ipc/kdbus/pool.c +++ b/ipc/kdbus/pool.c @@ -616,10 +616,10 @@ ssize_t kdbus_pool_slice_copy_kvec(const struct kdbus_pool_slice *slice, 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); @@ -653,7 +653,7 @@ int kdbus_pool_slice_copy(const struct kdbus_pool_slice *slice_dst, 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;