linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Edward Adam Davis <eadavis@qq.com>,
	syzbot+fcc47ba2476570cbbeb0@syzkaller.appspotmail.com
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] null_blk: fix warning in blk_mq_start_request
Date: Tue, 7 Nov 2023 21:26:32 -0800	[thread overview]
Message-ID: <25a94b23-b42b-49fc-a1c8-3e635f536aae@acm.org> (raw)
In-Reply-To: <tencent_03A5938DE6921DDDE9DD921956CFAD0DE007@qq.com>

On 11/7/23 18:46, Edward Adam Davis wrote:
> Before call blk_mq_start_request() in null_queue_rq(), initialize rq->state to
> MQ_RQ_IDLE.
> 
> Reported-and-tested-by: syzbot+fcc47ba2476570cbbeb0@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
>   drivers/block/null_blk/main.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 22a3cf7f32e2..0726534a5a24 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -1724,6 +1724,8 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
>   	cmd->fake_timeout = should_timeout_request(rq) ||
>   		blk_should_fake_timeout(rq->q);
>   
> +	if (READ_ONCE(rq->state))
> +		WRITE_ONCE(rq->state, MQ_RQ_IDLE);
>   	blk_mq_start_request(rq);
>   
>   	if (should_requeue_request(rq)) {

All code that changes rq->state should occur in the block layer
core. Block drivers must not modify rq->state directly.

Bart.

  reply	other threads:[~2023-11-08  5:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  7:29 [syzbot] [block?] WARNING in blk_mq_start_request syzbot
2023-11-08  2:46 ` [PATCH] null_blk: fix warning " Edward Adam Davis
2023-11-08  5:26   ` Bart Van Assche [this message]
2023-11-08  6:59     ` [PATCH V2] blk-mq: " Edward Adam Davis
2023-11-08  7:26       ` Christoph Hellwig
2023-11-08  6:40   ` [PATCH] null_blk: " Chaitanya Kulkarni
2023-11-08  7:07     ` Edward Adam Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25a94b23-b42b-49fc-a1c8-3e635f536aae@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=eadavis@qq.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+fcc47ba2476570cbbeb0@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).