From: Dan Carpenter <dan@pereq.eu>
To: Marc Zyngier <maz@kernel.org>
Cc: "Oliver Upton" <oupton@kernel.org>,
"Fuad Tabba" <fuad.tabba@linux.dev>,
"Joey Gouly" <joey.gouly@arm.com>,
"Steffen Eiden" <seiden@linux.ibm.com>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>,
"Zenghui Yu" <yuzenghui@huawei.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org,
"Karthik Bhargavan" <karthik@pereq.eu>,
"Clément Blaudeau" <clement@cryspen.com>
Subject: Re: [PATCH] KVM: arm64: nv: Fix NULL dereference in kvm_inject_nested()
Date: Wed, 18 Nov 2026 13:41:20 +0300 [thread overview]
Message-ID: <av2A0FxSab9P3eMW@stanley.mountain> (raw)
In-Reply-To: <86h5hg1wak.wl-maz@kernel.org>
On Mon, Nov 16, 2026 at 06:11:15PM +0000, Marc Zyngier wrote:
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 5959bbbfa026f..21cd872ea394b 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -2007,7 +2007,7 @@ static int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
> static int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
> struct kvm_vcpu_events *events)
> {
> - int i;
> + int i, ret;
>
> /* check whether the reserved field is zero */
> for (i = 0; i < ARRAY_SIZE(events->reserved); i++)
> @@ -2019,7 +2019,11 @@ static int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
> if (events->exception.pad[i])
> return -EINVAL;
>
> - return __kvm_arm_vcpu_set_events(vcpu, events);
> + vcpu_load(vcpu);
> + ret = __kvm_arm_vcpu_set_events(vcpu, events);
> + vcpu_put(vcpu);
> +
> + return ret;
> }
>
> /*
>
> and be done with it, avoiding the fast-path bloating altogether.
> Unless you can spot another path where the vcpu is not loaded, but
> still requires the injection of an exception?
I feel like this approach brings arm64 slightly more in line with
x86 so I like it. I'll send that.
I'm still redoing the TCR2 changes so I won't send those today.
regards,
dan carpenter
prev parent reply other threads:[~2026-11-18 10:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:40 [PATCH] KVM: arm64: nv: Fix NULL dereference in kvm_inject_nested() Dan Carpenter
2026-11-16 14:06 ` sashiko-bot
2026-11-16 15:27 ` Dan Carpenter
2026-11-16 18:11 ` Marc Zyngier
2026-11-18 10:41 ` Dan Carpenter [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=av2A0FxSab9P3eMW@stanley.mountain \
--to=dan@pereq.eu \
--cc=catalin.marinas@arm.com \
--cc=clement@cryspen.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=karthik@pereq.eu \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.