From 91559bea78494c7b4e16e60c30b77f7d3ea1da51 Mon Sep 17 00:00:00 2001 From: Jeffle Xu Date: Tue, 10 Nov 2020 16:14:13 +0800 Subject: [PATCH 2282/2944] alinux: Revert "blk-mq: fix NULL pointer deference in case no poll implementation" This reverts commit 1e41c5056619ec50b8146534881d6e0d6a7ca5ba. Back upon the time of this commit, QUEUE_FLAG_POLL is included in default MQ flags. QUEUE_FLAG_POLL will be set for every mq device even the mq_ops->poll may be NULL, and thus may trigger NULL pointer in blk_poll(). commit 294d5fb28de8 ("alinux: blk-mq: remove QUEUE_FLAG_POLL from default MQ flags") has removed QUEUE_FLAG_POLL from default MQ flags, and set QUEUE_FLAG_POLL only when mq_ops->poll is non-NULL. Since then the original commit is no longer needed. Signed-off-by: Jeffle Xu Reviewed-by: Joseph Qi --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 8319e86..b480310 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3450,7 +3450,7 @@ int blk_poll(struct request_queue *q, blk_qc_t cookie, bool spin) struct blk_mq_hw_ctx *hctx; long state; - if (!blk_qc_t_valid(cookie) || !q->mq_ops->poll || + if (!blk_qc_t_valid(cookie) || !test_bit(QUEUE_FLAG_POLL, &q->queue_flags)) return 0; -- 1.8.3.1