From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: Keith Busch <kbusch@kernel.org>,
Klaus Jensen <k.jensen@samsung.com>,
qemu-stable@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH] hw/nvme: fix missing check for PMR capability
Date: Tue, 29 Jun 2021 07:19:28 +0200 [thread overview]
Message-ID: <YNqtYA5FZOBpFj5V@apples.localdomain> (raw)
In-Reply-To: <20210607094757.29661-1-its@irrelevant.dk>
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
On Jun 7 11:47, Klaus Jensen wrote:
>From: Klaus Jensen <k.jensen@samsung.com>
>
>Qiang Liu reported that an access on an unknown address is triggered in
>memory_region_set_enabled because a check on CAP.PMRS is missing for the
>PMRCTL register write when no PMR is configured.
>
>Cc: qemu-stable@nongnu.org
>Fixes: 75c3c9de961d ("hw/block/nvme: disable PMR at boot up")
>Resolves: https://gitlab.com/qemu-project/qemu/-/issues/362
>Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
>---
> hw/nvme/ctrl.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
>index 0bcaf7192f99..463772602c4e 100644
>--- a/hw/nvme/ctrl.c
>+++ b/hw/nvme/ctrl.c
>@@ -5583,6 +5583,10 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data,
> "invalid write to PMRCAP register, ignored");
> return;
> case 0xe04: /* PMRCTL */
>+ if (!NVME_CAP_PMRS(n->bar.cap)) {
>+ return;
>+ }
>+
> n->bar.pmrctl = data;
> if (NVME_PMRCTL_EN(data)) {
> memory_region_set_enabled(&n->pmr.dev->mr, true);
>--
>2.31.1
>
Applied to nvme-next!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2021-06-29 5:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 9:47 [PATCH] hw/nvme: fix missing check for PMR capability Klaus Jensen
2021-06-17 19:17 ` Klaus Jensen
2021-06-28 17:03 ` Klaus Jensen
2021-06-28 20:35 ` Keith Busch
2021-06-29 5:19 ` Klaus Jensen [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:
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=YNqtYA5FZOBpFj5V@apples.localdomain \
--to=its@irrelevant.dk \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.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 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).