]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - block/bio.c
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux.git] / block / bio.c
index 4f184d938942dcbbbbedbac3b330f6e4bb39a4a9..cf7591551b1716b74fa3765cb1c271a554e8ef56 100644 (file)
@@ -874,7 +874,7 @@ int submit_bio_wait(int rw, struct bio *bio)
        bio->bi_private = &ret;
        bio->bi_end_io = submit_bio_wait_endio;
        submit_bio(rw, bio);
-       wait_for_completion(&ret.event);
+       wait_for_completion_io(&ret.event);
 
        return ret.error;
 }
@@ -1090,9 +1090,12 @@ int bio_uncopy_user(struct bio *bio)
        if (!bio_flagged(bio, BIO_NULL_MAPPED)) {
                /*
                 * if we're in a workqueue, the request is orphaned, so
-                * don't copy into a random user address space, just free.
+                * don't copy into a random user address space, just free
+                * and return -EINTR so user space doesn't expect any data.
                 */
-               if (current->mm && bio_data_dir(bio) == READ)
+               if (!current->mm)
+                       ret = -EINTR;
+               else if (bio_data_dir(bio) == READ)
                        ret = bio_copy_to_iter(bio, bmd->iter);
                if (bmd->is_our_pages)
                        bio_free_pages(bio);
@@ -1125,7 +1128,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
        int i, ret;
        int nr_pages = 0;
        unsigned int len = iter->count;
-       unsigned int offset = map_data ? map_data->offset & ~PAGE_MASK : 0;
+       unsigned int offset = map_data ? offset_in_page(map_data->offset) : 0;
 
        for (i = 0; i < iter->nr_segs; i++) {
                unsigned long uaddr;
@@ -1304,7 +1307,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
                        goto out_unmap;
                }
 
-               offset = uaddr & ~PAGE_MASK;
+               offset = offset_in_page(uaddr);
                for (j = cur_page; j < page_limit; j++) {
                        unsigned int bytes = PAGE_SIZE - offset;