Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] blk-mq: remove WARN_ON(!q->elevator) from blk_mq_sched_free_requests
@ 2019-06-11  9:31 Ming Lei
  2019-06-13  9:06 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2019-06-11  9:31 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Ming Lei, Bart Van Assche, Christoph Hellwig,
	Yi Zhang, syzbot+b9d0d56867048c7bcfde

blk_mq_sched_free_requests() may be called in failure path in which
q->elevator may not be setup yet, so remove WARN_ON(!q->elevator) from
blk_mq_sched_free_requests for avoiding the false positive.

This function is actually safe to call in case of !q->elevator because
hctx->sched_tags is checked.

Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Yi Zhang <yi.zhang@redhat.com>
Fixes: c3e2219216c9 ("block: free sched's request pool in blk_cleanup_queue")
Reported-by: syzbot+b9d0d56867048c7bcfde@syzkaller.appspotmail.com
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq-sched.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 500cb04901cc..2766066a15db 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -555,7 +555,6 @@ void blk_mq_sched_free_requests(struct request_queue *q)
 	int i;
 
 	lockdep_assert_held(&q->sysfs_lock);
-	WARN_ON(!q->elevator);
 
 	queue_for_each_hw_ctx(q, hctx, i) {
 		if (hctx->sched_tags)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] blk-mq: remove WARN_ON(!q->elevator) from blk_mq_sched_free_requests
  2019-06-11  9:31 [PATCH] blk-mq: remove WARN_ON(!q->elevator) from blk_mq_sched_free_requests Ming Lei
@ 2019-06-13  9:06 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-06-13  9:06 UTC (permalink / raw)
  To: Ming Lei
  Cc: linux-block, Bart Van Assche, Christoph Hellwig, Yi Zhang,
	syzbot+b9d0d56867048c7bcfde

On 6/11/19 3:31 AM, Ming Lei wrote:
> blk_mq_sched_free_requests() may be called in failure path in which
> q->elevator may not be setup yet, so remove WARN_ON(!q->elevator) from
> blk_mq_sched_free_requests for avoiding the false positive.
> 
> This function is actually safe to call in case of !q->elevator because
> hctx->sched_tags is checked.

Applied, thanks Ming.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11  9:31 [PATCH] blk-mq: remove WARN_ON(!q->elevator) from blk_mq_sched_free_requests Ming Lei
2019-06-13  9:06 ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git