Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1a9fba0 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "block: Fix a NULL pointer dereference in generic_make_request()"

parents a77c53f2 1d79611f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2228,7 +2228,9 @@ blk_qc_t generic_make_request(struct bio *bio)

	if (bio->bi_opf & REQ_NOWAIT)
		flags = BLK_MQ_REQ_NOWAIT;
	if (blk_queue_enter(q, flags) < 0) {
	if (bio_flagged(bio, BIO_QUEUE_ENTERED))
		blk_queue_enter_live(q);
	else if (blk_queue_enter(q, flags) < 0) {
		if (!blk_queue_dying(q) && (bio->bi_opf & REQ_NOWAIT))
			bio_wouldblock_error(bio);
		else
@@ -2281,10 +2283,8 @@ blk_qc_t generic_make_request(struct bio *bio)
			flags = 0;
			if (bio->bi_opf & REQ_NOWAIT)
				flags = BLK_MQ_REQ_NOWAIT;
			if (blk_queue_enter(q, flags) < 0) {
			if (blk_queue_enter(q, flags) < 0)
				enter_succeeded = false;
				q = NULL;
			}
		}

		if (enter_succeeded) {
@@ -2315,6 +2315,7 @@ blk_qc_t generic_make_request(struct bio *bio)
				bio_wouldblock_error(bio);
			else
				bio_io_error(bio);
			q = NULL;
		}
		bio = bio_list_pop(&bio_list_on_stack[0]);
	} while (bio);
+10 −0
Original line number Diff line number Diff line
@@ -211,6 +211,16 @@ void blk_queue_split(struct request_queue *q, struct bio **bio)
		/* there isn't chance to merge the splitted bio */
		split->bi_opf |= REQ_NOMERGE;

		/*
		 * Since we're recursing into make_request here, ensure
		 * that we mark this bio as already having entered the queue.
		 * If not, and the queue is going away, we can get stuck
		 * forever on waiting for the queue reference to drop. But
		 * that will never happen, as we're already holding a
		 * reference to it.
		 */
		bio_set_flag(*bio, BIO_QUEUE_ENTERED);

		bio_chain(split, *bio);
		trace_block_split(q, split, (*bio)->bi_iter.bi_sector);
		generic_make_request(*bio);
+2 −0
Original line number Diff line number Diff line
@@ -150,6 +150,8 @@ struct bio {
				 * throttling rules. Don't do it again. */
#define BIO_TRACE_COMPLETION 11	/* bio_endio() should trace the final completion
				 * of this bio. */
#define BIO_QUEUE_ENTERED 11	/* can use blk_queue_enter_live() */

/* See BVEC_POOL_OFFSET below before adding new flags */

/*