All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Laibin Qiu <qiulaibin@huawei.com>
Cc: tj@kernel.org, axboe@kernel.dk, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next v2] blk-throttle: Set BIO_THROTTLED when bio has been throttled
Date: Wed, 2 Mar 2022 21:51:13 +0800	[thread overview]
Message-ID: <Yh92UQ9/bxe6EcWe@T590> (raw)
In-Reply-To: <20220301123919.2381579-1-qiulaibin@huawei.com>

On Tue, Mar 01, 2022 at 08:39:19PM +0800, Laibin Qiu wrote:
> 1.In current process, all bio will set the BIO_THROTTLED flag
> after __blk_throtl_bio().
> 
> 2.If bio needs to be throttled, it will start the timer and
> stop submit bio directly. Bio will submit in
> blk_throtl_dispatch_work_fn() when the timer expires.But in
> the current process, if bio is throttled. The BIO_THROTTLED
> will be set to bio after timer start. If the bio has been
> completed, it may cause use-after-free blow.
> 
> BUG: KASAN: use-after-free in blk_throtl_bio+0x12f0/0x2c70
> Read of size 2 at addr ffff88801b8902d4 by task fio/26380

After the queue lock is released, the bio can be dispatched & completed,
so it shouldn't be touched after lock release:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming


  reply	other threads:[~2022-03-02 13:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 12:39 [PATCH -next v2] blk-throttle: Set BIO_THROTTLED when bio has been throttled Laibin Qiu
2022-03-01 12:39 ` Laibin Qiu
2022-03-02 13:51 ` Ming Lei [this message]
2022-05-18  0:39   ` QiuLaibin
2022-05-18  0:39     ` QiuLaibin
     [not found] ` <20220301123919.2381579-1-qiulaibin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-05-18  1:32   ` Jens Axboe
2022-05-18  1:32     ` Jens Axboe

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=Yh92UQ9/bxe6EcWe@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qiulaibin@huawei.com \
    --cc=tj@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.