aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-05-22 18:15:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-22 18:15:30 -0400
commit1c8df7bd48347a707b437cfd0dad6b08a3b89ab6 (patch)
tree6b851006a791d0595061600b1685d4db7e85f1f7
parenta30ec4b347192f65e811b0b165ef08fa1ba379c4 (diff)
parent10d784eae2b41e25d8fc6a88096cd27286093c84 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "Three small fixes that have been picked up the last few weeks. Specifically: - Fix a memory corruption issue in NVMe with malignant user constructed request. From Christoph. - Kill (now) unused blk_queue_bio(), dm was changed to not need this anymore. From Mike Snitzer. - Always use blk_schedule_flush_plug() from the io_schedule() path when flushing a plug, fixing a !TASK_RUNNING warning with md. From Shaohua" * 'for-linus' of git://git.kernel.dk/linux-block: sched: always use blk_schedule_flush_plug in io_schedule_out nvme: fix kernel memory corruption with short INQUIRY buffers block: remove export for blk_queue_bio
-rw-r--r--block/blk-core.c5
-rw-r--r--drivers/block/nvme-scsi.c3
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--kernel/sched/core.c5
4 files changed, 6 insertions, 9 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 7871603f0a29..03b5f8d77f37 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -734,6 +734,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
734} 734}
735EXPORT_SYMBOL(blk_init_queue_node); 735EXPORT_SYMBOL(blk_init_queue_node);
736 736
737static void blk_queue_bio(struct request_queue *q, struct bio *bio);
738
737struct request_queue * 739struct request_queue *
738blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, 740blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
739 spinlock_t *lock) 741 spinlock_t *lock)
@@ -1578,7 +1580,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)
1578 blk_rq_bio_prep(req->q, req, bio); 1580 blk_rq_bio_prep(req->q, req, bio);
1579} 1581}
1580 1582
1581void blk_queue_bio(struct request_queue *q, struct bio *bio) 1583static void blk_queue_bio(struct request_queue *q, struct bio *bio)
1582{ 1584{
1583 const bool sync = !!(bio->bi_rw & REQ_SYNC); 1585 const bool sync = !!(bio->bi_rw & REQ_SYNC);
1584 struct blk_plug *plug; 1586 struct blk_plug *plug;
@@ -1686,7 +1688,6 @@ out_unlock:
1686 spin_unlock_irq(q->queue_lock); 1688 spin_unlock_irq(q->queue_lock);
1687 } 1689 }
1688} 1690}
1689EXPORT_SYMBOL_GPL(blk_queue_bio); /* for device mapper only */
1690 1691
1691/* 1692/*
1692 * If bio->bi_dev is a partition, remap the location 1693 * If bio->bi_dev is a partition, remap the location
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c
index 88f13c525712..44f2514fb775 100644
--- a/drivers/block/nvme-scsi.c
+++ b/drivers/block/nvme-scsi.c
@@ -2257,7 +2257,8 @@ static int nvme_trans_inquiry(struct nvme_ns *ns, struct sg_io_hdr *hdr,
2257 page_code = GET_INQ_PAGE_CODE(cmd); 2257 page_code = GET_INQ_PAGE_CODE(cmd);
2258 alloc_len = GET_INQ_ALLOC_LENGTH(cmd); 2258 alloc_len = GET_INQ_ALLOC_LENGTH(cmd);
2259 2259
2260 inq_response = kmalloc(alloc_len, GFP_KERNEL); 2260 inq_response = kmalloc(max(alloc_len, STANDARD_INQUIRY_LENGTH),
2261 GFP_KERNEL);
2261 if (inq_response == NULL) { 2262 if (inq_response == NULL) {
2262 res = -ENOMEM; 2263 res = -ENOMEM;
2263 goto out_mem; 2264 goto out_mem;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7f9a516f24de..5d93a6645e88 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -821,8 +821,6 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
821extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, 821extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
822 struct scsi_ioctl_command __user *); 822 struct scsi_ioctl_command __user *);
823 823
824extern void blk_queue_bio(struct request_queue *q, struct bio *bio);
825
826/* 824/*
827 * A queue has just exitted congestion. Note this in the global counter of 825 * A queue has just exitted congestion. Note this in the global counter of
828 * congested queues, and wake up anyone who was waiting for requests to be 826 * congested queues, and wake up anyone who was waiting for requests to be
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 57bd333bc4ab..123673291ffb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4389,10 +4389,7 @@ long __sched io_schedule_timeout(long timeout)
4389 long ret; 4389 long ret;
4390 4390
4391 current->in_iowait = 1; 4391 current->in_iowait = 1;
4392 if (old_iowait) 4392 blk_schedule_flush_plug(current);
4393 blk_schedule_flush_plug(current);
4394 else
4395 blk_flush_plug(current);
4396 4393
4397 delayacct_blkio_start(); 4394 delayacct_blkio_start();
4398 rq = raw_rq(); 4395 rq = raw_rq();