From: Kanchan Joshi <joshi.k@samsung.com>
To: Keith Busch <kbusch@kernel.org>
Cc: hch@lst.de, axboe@kernel.dk, sagi@grimberg.me,
linux-nvme@lists.infradead.org, vincentfu@gmail.com,
ankit.kumar@samsung.com, joshiiitr@gmail.com,
gost.dev@samsung.com, stable@vger.kernel.org,
Vincent Fu <vincent.fu@samsung.com>
Subject: Re: [PATCH 1/2] nvme: fix memory corruption for passthrough metadata
Date: Mon, 14 Aug 2023 12:11:30 +0530 [thread overview]
Message-ID: <20230814064130.GA6702@green245> (raw)
In-Reply-To: <ZNZogPZtHsxi1S10@kbusch-mbp.dhcp.thefacebook.com>
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
On Fri, Aug 11, 2023 at 10:57:36AM -0600, Keith Busch wrote:
>On Fri, Aug 11, 2023 at 09:29:05PM +0530, Kanchan Joshi wrote:
>> +static bool nvme_validate_passthru_meta(struct nvme_ctrl *ctrl,
>> + struct nvme_ns *ns,
>> + struct nvme_command *c,
>> + __u64 meta, __u32 meta_len)
>> +{
>> + /*
>> + * User may specify smaller meta-buffer with a larger data-buffer.
>> + * Driver allocated meta buffer will also be small.
>> + * Device can do larger dma into that, overwriting unrelated kernel
>> + * memory.
>> + */
>> + if (ns && (meta_len || meta)) {
>> + u16 nlb = lower_16_bits(le32_to_cpu(c->common.cdw12));
>> +
>> + if (meta_len != (nlb + 1) * ns->ms) {
>> + dev_err(ctrl->device,
>> + "%s: metadata length does not match!\n", current->comm);
>> + return false;
>> + }
>
>Don't you need to check the command PRINFO PRACT bit to know if metadata
>length is striped/generated on the controller side?
Good point. Will add that check in v2.
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2023-08-14 6:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230811160449epcas5p3beee9d2c65c71e95d8e92f25fb1f98c4@epcas5p3.samsung.com>
2023-08-11 15:59 ` [PATCH 0/2] Fix memory-corruption for passthrough metadata Kanchan Joshi
2023-08-11 15:59 ` [PATCH 1/2] nvme: fix memory corruption " Kanchan Joshi
2023-08-11 16:57 ` Keith Busch
2023-08-14 6:41 ` Kanchan Joshi [this message]
2023-08-11 15:59 ` [PATCH 2/2] nvme: avoid memory corruption for sync passthrough Kanchan Joshi
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=20230814064130.GA6702@green245 \
--to=joshi.k@samsung.com \
--cc=ankit.kumar@samsung.com \
--cc=axboe@kernel.dk \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=joshiiitr@gmail.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=stable@vger.kernel.org \
--cc=vincent.fu@samsung.com \
--cc=vincentfu@gmail.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