mm/memory-failure: send SIGBUS(BUS_MCEERR_AR) only to current thread
[linux-2.6-microblaze.git] / fs / io_uring.c
index 9d4bd0d..26f7bc9 100644 (file)
@@ -55,7 +55,6 @@
 #include <linux/fdtable.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
-#include <linux/mmu_context.h>
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <linux/kthread.h>
@@ -5867,7 +5866,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
        if (io_op_defs[req->opcode].needs_mm && !current->mm) {
                if (unlikely(!mmget_not_zero(ctx->sqo_mm)))
                        return -EFAULT;
-               use_mm(ctx->sqo_mm);
+               kthread_use_mm(ctx->sqo_mm);
        }
 
        sqe_flags = READ_ONCE(sqe->flags);
@@ -5981,7 +5980,7 @@ static inline void io_sq_thread_drop_mm(struct io_ring_ctx *ctx)
        struct mm_struct *mm = current->mm;
 
        if (mm) {
-               unuse_mm(mm);
+               kthread_unuse_mm(mm);
                mmput(mm);
        }
 }
@@ -5990,15 +5989,12 @@ static int io_sq_thread(void *data)
 {
        struct io_ring_ctx *ctx = data;
        const struct cred *old_cred;
-       mm_segment_t old_fs;
        DEFINE_WAIT(wait);
        unsigned long timeout;
        int ret = 0;
 
        complete(&ctx->sq_thread_comp);
 
-       old_fs = get_fs();
-       set_fs(USER_DS);
        old_cred = override_creds(ctx->creds);
 
        timeout = jiffies + ctx->sq_thread_idle;
@@ -6103,7 +6099,6 @@ static int io_sq_thread(void *data)
        if (current->task_works)
                task_work_run();
 
-       set_fs(old_fs);
        io_sq_thread_drop_mm(ctx);
        revert_creds(old_cred);
 
@@ -7186,7 +7181,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void __user *arg,
                }
 
                ret = 0;
-               down_read(&current->mm->mmap_sem);
+               mmap_read_lock(current->mm);
                pret = pin_user_pages(ubuf, nr_pages,
                                      FOLL_WRITE | FOLL_LONGTERM,
                                      pages, vmas);
@@ -7204,7 +7199,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void __user *arg,
                } else {
                        ret = pret < 0 ? pret : -EFAULT;
                }
-               up_read(&current->mm->mmap_sem);
+               mmap_read_unlock(current->mm);
                if (ret) {
                        /*
                         * if we did partial map, or found file backed vmas,