archive mirror
 help / color / mirror / Atom feed
From: "yukuai (C)" <>
To: Greg KH <>
Cc: <>, <>,
	<>, <>, <>
Subject: Re: [PATCH linux-4.19.y] blk-mq: fix divide by zero crash in tg_may_dispatch()
Date: Wed, 15 Sep 2021 19:58:44 +0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 2021/09/15 19:27, Greg KH wrote:
> On Tue, Sep 14, 2021 at 08:54:02PM +0800, Yu Kuai wrote:
>> If blk-throttle is enabled and io is issued before
>> blk_throtl_register_queue() is done. Divide by zero crash will be
>> triggered in tg_may_dispatch() because 'throtl_slice' is uninitialized.
>> The problem is fixed in commit 75f4dca59694 ("block: call
>> blk_register_queue earlier in device_add_disk") from mainline, however
>> it's too hard to backport this patch due to lots of refactoring.
>> Thus introduce a new flag QUEUE_FLAG_THROTL_INIT_DONE. It will be set
>> after blk_throtl_register_queue() is done, and will be checked before
>> applying any config.
>> Signed-off-by: Yu Kuai <>
>> ---
>>   block/blk-sysfs.c      |  2 ++
>>   block/blk-throttle.c   | 41 +++++++++++++++++++++++++++++++++++++++--
>>   include/linux/blkdev.h |  1 +
>>   3 files changed, 42 insertions(+), 2 deletions(-)
> The commit you reference above is in 5.15-rc1.  What about all of the
> other stable kernel releases newer than 4.19.y?  You do not want to move
> to a newer release and have a regression.

All other kernel releases without this patch have the same issure,
including v5.14.
> And I would _REALLY_ like to take the identical commits that are
> upstream if at all possible.  What is needed to backport instead of
> doing this one-off patch instead?

The function __device_add_disk() is quite different compared from
4.19.y to mainline, I haven't finish to collect that how many patches is
needed yet, which is not easy to do...
> When we take changes that are not upstream, almost always they are
> broken so we almost never want to do that.

I understand that, more proper fix should be calling blk_register_queue
earlier in device_add_disk like the commit did. I'll try to do that and
hope conflicts are not too much...

> thanks,
> greg k-h
> .

      reply	other threads:[~2021-09-15 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 12:54 [PATCH linux-4.19.y] blk-mq: fix divide by zero crash in tg_may_dispatch() Yu Kuai
2021-09-15 11:27 ` Greg KH
2021-09-15 11:58   ` yukuai (C) [this message]

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:

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

  git send-email \ \ \ \ \ \ \ \ \

* 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).