From: Jens Axboe <axboe@kernel.dk>
To: Fengnan Chang <fengnanchang@gmail.com>,
linux-block@vger.kernel.org, ming.lei@redhat.com, hare@suse.de,
hch@lst.de, yukuai@fnnas.com
Cc: Fengnan Chang <changfengnan@bytedance.com>, Yu Kuai <yukuai3@huawei.com>
Subject: Re: [PATCH v3 2/2] blk-mq: fix potential uaf for 'queue_hw_ctx'
Date: Fri, 28 Nov 2025 09:20:48 -0700 [thread overview]
Message-ID: <c0e60e0c-42fb-438c-9d15-5f62567c1963@kernel.dk> (raw)
In-Reply-To: <20251128085314.8991-3-changfengnan@bytedance.com>
On 11/28/25 1:53 AM, Fengnan Chang wrote:
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 0795f29dd65d..c16875b35521 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -999,9 +999,20 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq)
> return rq + 1;
> }
>
> +static inline struct blk_mq_hw_ctx *queue_hctx(struct request_queue *q, int id)
> +{
> + struct blk_mq_hw_ctx *hctx;
> +
> + rcu_read_lock();
> + hctx = rcu_dereference(q->queue_hw_ctx)[id];
> + rcu_read_unlock();
> +
> + return hctx;
> +}
Should eg blk_mq_map_queue_type() use this helper now too?
Note: I've applied this, so anything beyond this v3 should be an
incremental against the current tree.
--
Jens Axboe
next prev parent reply other threads:[~2025-11-28 16:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 8:53 [PATCH v3 0/2] blk-mq: use array manage hctx map instead of xarray Fengnan Chang
2025-11-28 8:53 ` [PATCH v3 1/2] " Fengnan Chang
2025-11-28 8:53 ` [PATCH v3 2/2] blk-mq: fix potential uaf for 'queue_hw_ctx' Fengnan Chang
2025-11-28 16:20 ` Jens Axboe [this message]
2025-12-01 12:26 ` fengnan chang
2025-11-28 9:54 ` [PATCH v3 0/2] blk-mq: use array manage hctx map instead of xarray Yu Kuai
2025-11-28 10:00 ` fengnan chang
2025-11-28 16:09 ` Jens Axboe
2025-11-28 16:22 ` 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=c0e60e0c-42fb-438c-9d15-5f62567c1963@kernel.dk \
--to=axboe@kernel.dk \
--cc=changfengnan@bytedance.com \
--cc=fengnanchang@gmail.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=yukuai3@huawei.com \
--cc=yukuai@fnnas.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).