Эх сурвалжийг харах

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
Linus Torvalds 10 жил өмнө
parent
commit
1c8df7bd48

+ 3 - 2
block/blk-core.c

@@ -734,6 +734,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
 }
 }
 EXPORT_SYMBOL(blk_init_queue_node);
 EXPORT_SYMBOL(blk_init_queue_node);
 
 
+static void blk_queue_bio(struct request_queue *q, struct bio *bio);
+
 struct request_queue *
 struct request_queue *
 blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
 blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
 			 spinlock_t *lock)
 			 spinlock_t *lock)
@@ -1578,7 +1580,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)
 	blk_rq_bio_prep(req->q, req, bio);
 	blk_rq_bio_prep(req->q, req, bio);
 }
 }
 
 
-void blk_queue_bio(struct request_queue *q, struct bio *bio)
+static void blk_queue_bio(struct request_queue *q, struct bio *bio)
 {
 {
 	const bool sync = !!(bio->bi_rw & REQ_SYNC);
 	const bool sync = !!(bio->bi_rw & REQ_SYNC);
 	struct blk_plug *plug;
 	struct blk_plug *plug;
@@ -1686,7 +1688,6 @@ out_unlock:
 		spin_unlock_irq(q->queue_lock);
 		spin_unlock_irq(q->queue_lock);
 	}
 	}
 }
 }
-EXPORT_SYMBOL_GPL(blk_queue_bio);	/* for device mapper only */
 
 
 /*
 /*
  * If bio->bi_dev is a partition, remap the location
  * If bio->bi_dev is a partition, remap the location

+ 2 - 1
drivers/block/nvme-scsi.c

@@ -2257,7 +2257,8 @@ static int nvme_trans_inquiry(struct nvme_ns *ns, struct sg_io_hdr *hdr,
 	page_code = GET_INQ_PAGE_CODE(cmd);
 	page_code = GET_INQ_PAGE_CODE(cmd);
 	alloc_len = GET_INQ_ALLOC_LENGTH(cmd);
 	alloc_len = GET_INQ_ALLOC_LENGTH(cmd);
 
 
-	inq_response = kmalloc(alloc_len, GFP_KERNEL);
+	inq_response = kmalloc(max(alloc_len, STANDARD_INQUIRY_LENGTH),
+				GFP_KERNEL);
 	if (inq_response == NULL) {
 	if (inq_response == NULL) {
 		res = -ENOMEM;
 		res = -ENOMEM;
 		goto out_mem;
 		goto out_mem;

+ 0 - 2
include/linux/blkdev.h

@@ -821,8 +821,6 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
 extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
 extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
 			 struct scsi_ioctl_command __user *);
 			 struct scsi_ioctl_command __user *);
 
 
-extern void blk_queue_bio(struct request_queue *q, struct bio *bio);
-
 /*
 /*
  * A queue has just exitted congestion.  Note this in the global counter of
  * A queue has just exitted congestion.  Note this in the global counter of
  * congested queues, and wake up anyone who was waiting for requests to be
  * congested queues, and wake up anyone who was waiting for requests to be

+ 1 - 4
kernel/sched/core.c

@@ -4389,10 +4389,7 @@ long __sched io_schedule_timeout(long timeout)
 	long ret;
 	long ret;
 
 
 	current->in_iowait = 1;
 	current->in_iowait = 1;
-	if (old_iowait)
-		blk_schedule_flush_plug(current);
-	else
-		blk_flush_plug(current);
+	blk_schedule_flush_plug(current);
 
 
 	delayacct_blkio_start();
 	delayacct_blkio_start();
 	rq = raw_rq();
 	rq = raw_rq();