[UNTESTED PATCH] block: fix a potential null pointer dereference
From: Peng Wang
Date: Fri May 24 2019 - 02:16:57 EST
blk_queue_dying() still needs request_queue "q" when
enter_succeeded is false, so let's set "q" zero later.
Signed-off-by: Peng Wang <rocking@xxxxxxxxxx>
---
block/blk-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 419d600e6637..3d43909db3b8 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1056,7 +1056,6 @@ blk_qc_t generic_make_request(struct bio *bio)
flags = BLK_MQ_REQ_NOWAIT;
if (blk_queue_enter(q, flags) < 0) {
enter_succeeded = false;
- q = NULL;
}
}
@@ -1088,6 +1087,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);
--
2.19.1