mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: chengming.zhou@linux.dev, axboe@kernel.dk, ming.lei@redhat.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chengming Zhou <zhouchengming@bytedance.com>,
	Yi Zhang <yi.zhang@redhat.com>
Subject: Re: [PATCH] blk-mq: fix tags UAF when shrink nr_hw_queues
Date: Fri, 8 Sep 2023 07:51:16 +0200	[thread overview]
Message-ID: <98a47b9b-45ee-4166-aad7-6a2c05c201a0@suse.de> (raw)
In-Reply-To: <20230908005702.2183908-1-chengming.zhou@linux.dev>

On 9/8/23 02:57, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
> 
> When nr_hw_queues shrink, we free the excess tags before realloc
> hw_ctxs for each queue, during that we may need to access those
> tags, like blk_mq_tag_idle(hctx) will access queue shared tags.
> 
> So slab-use-after-free caused and reported by KASAN. Fix it by
> moving the releasing of excess tags to the end.
> 
> Fixes: e1dd7bc93029 ("blk-mq: fix tags leak when shrink nr_hw_queues")
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Closes: https://lore.kernel.org/all/CAHj4cs_CK63uoDpGBGZ6DN4OCTpzkR3UaVgK=LX8Owr8ej2ieQ@mail.gmail.com/
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> ---
>   block/blk-mq.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman


  reply	other threads:[~2023-09-08  5:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08  0:57 chengming.zhou
2023-09-08  5:51 ` Hannes Reinecke [this message]
2023-09-14 16:05 ` 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=98a47b9b-45ee-4166-aad7-6a2c05c201a0@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=chengming.zhou@linux.dev \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=yi.zhang@redhat.com \
    --cc=zhouchengming@bytedance.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

all inboxes | Powered by JetHome®