From patchwork Thu Feb 6 15:20:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13963211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBBDFC02198 for ; Thu, 6 Feb 2025 15:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1lmN/Mh96pOHwdG2ab4VMFJLNlZMvsX21i4tOrmIkk0=; b=cD1qVbXdAa+wK6JyzANdpj6qdv hXX1zhauui8VD7hkF+Tr29frZ9S6OJ8se1rtZKe+nMESK2FDBJcmeXYv2T8ovXv8Oi9JI3s862CiL B8i/mN7L2+uf07jOLRGuYQ2Wu35G5SKwm0Ln2eFZEtHNxETlC1QGk9pFZBSyYaokhi6OS8ZbsiPH9 HoLk8LESfFAaNK1b/uiHmFcnRvgsQ6Gkr0nqQD2672UjHgSCwk7D4DJOL/oUudylLW+kqDYpYl4Al KvY1dX8jhpbmtek1D9jO+MN3EDLL4WWPnsngUx3SvRiLqFLpQCLkvABf6zF/xkmepSSYwQTHzw4HU n7ggAHUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tg3mE-00000006hmZ-46gQ; Thu, 06 Feb 2025 15:26:50 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tg3gu-00000006hAe-2AbW for linux-arm-kernel@bombadil.infradead.org; Thu, 06 Feb 2025 15:21:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=1lmN/Mh96pOHwdG2ab4VMFJLNlZMvsX21i4tOrmIkk0=; b=ShS2Jy73uCzUvFFfrSLbnYB7Zn inKSSaI3s/tQtSqyLpX/Fm5rGJarx8Qn+fM1dlFjAk9laNMb2+wfLMhk0NBq0SZYYEoRP7iODItW8 s+FhcNFbDiQSRSTmiuW8M751qQ9xqI+0qYLk6Fru50rxz7TZT/R7V21QOTkHFlYKLOgBaPC9poOx2 PW0585V6b9WqOm76gr+svi4s/bKC98YxFFBKl56dz7drHUq9i/rMqJFsm+zSQjzaL32LDDthQ+c/3 aiwTQIlU8kDF/S/3CBQ5blh0qLDbjP8SEslTDW54VsP5VBgR4huMKZM45tvyYSInxDHzWUqLYfhCG rrBuG15Q==; Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tg3gr-0000000GySP-1as6 for linux-arm-kernel@lists.infradead.org; Thu, 06 Feb 2025 15:21:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6D8F25C624A; Thu, 6 Feb 2025 15:20:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB9AC4CEDF; Thu, 6 Feb 2025 15:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738855272; bh=fGkPZyC1lHaD1dNGIgbR3MqllKvLH1NgrTHM4VOF/rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DAPAqhM8xt+twMxtoArge3pECx/FD9GqReBEPTDv1rOzbK/WPMa8I5zDqHagGBREk sA74L5y7Q2TjyKTfzg6Y7Fj8e0h5n85bsW8bf4mdTALDj/uWCBofnPeTSa9P5HjMli gcbnTqicA8AIvE5PCAfMd3Z8O6dZ41167rto5b1sM1YrwPozWZAp221XLGw5z9JIW0 TnFmoY6LXIcuOADbNyrH5df0HBRJ4BRFiz6quAld7tsUDDwgmy5qB9S2se5PH37x7M BlI4iTBR2tnnpvZPn1CsvSVwyt75dQnEk5pvqfrL4aDQSgNNmBx2GeJE/aspcTdaJ5 TTzTmIQsD2IZw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tg3gk-001Axu-CO; Thu, 06 Feb 2025 15:21:10 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Alexander Potapenko , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH 1/3] KVM: arm64: timer: Drop warning on failed interrupt signalling Date: Thu, 6 Feb 2025 15:20:58 +0000 Message-Id: <20250206152100.1107909-2-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250206152100.1107909-1-maz@kernel.org> References: <20250206152100.1107909-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, glider@google.com, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250206_152117_586854_72419D73 X-CRM114-Status: GOOD ( 10.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We currently spit out a warning if making a timer interrupt pending fails. But not only this is loud and easy to trigger from userspace, we also fail to do anything useful with that information. Dropping the warning is the easiest thing to do for now. We can always add error reporting if we really want in the future. Reported-by: Alexander Potapenko Signed-off-by: Marc Zyngier Tested-by: Alexander Potapenko --- arch/arm64/kvm/arch_timer.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c index 231c0cd9c7b4b..70802e4c91cf5 100644 --- a/arch/arm64/kvm/arch_timer.c +++ b/arch/arm64/kvm/arch_timer.c @@ -447,21 +447,19 @@ static void kvm_timer_update_status(struct arch_timer_context *ctx, bool level) static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level, struct arch_timer_context *timer_ctx) { - int ret; - kvm_timer_update_status(timer_ctx, new_level); timer_ctx->irq.level = new_level; trace_kvm_timer_update_irq(vcpu->vcpu_id, timer_irq(timer_ctx), timer_ctx->irq.level); - if (!userspace_irqchip(vcpu->kvm)) { - ret = kvm_vgic_inject_irq(vcpu->kvm, vcpu, - timer_irq(timer_ctx), - timer_ctx->irq.level, - timer_ctx); - WARN_ON(ret); - } + if (userspace_irqchip(vcpu->kvm)) + return; + + kvm_vgic_inject_irq(vcpu->kvm, vcpu, + timer_irq(timer_ctx), + timer_ctx->irq.level, + timer_ctx); } /* Only called for a fully emulated timer */ From patchwork Thu Feb 6 15:20:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13963209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BDEEC02194 for ; Thu, 6 Feb 2025 15:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vMj8WKQtw2NnS6B9DO9gDH0UzdVO07zJ1hnAbUg5rEk=; b=w0tfyRN8w3NRe03vBGeLcDpiTX WiK0VsHNpiBnN64VamRP+ewqKiGLyWzxXkU7B/pOc7EFctN78Az8ukTvYBSPXACkGhig1PTN5Y5t1 gue1NMi1XA0r/TYSsNj4FrZ7U/UlsnT2wui9eUYzQaHeKsefbfAnFwR9CRiDbzOEwGqSPp6YOHfOo KWRkiz7TSUxA/V5b3mbmxmouG5ZYhhit3KmlTl1K4nVRhcAvu7xd06VIJhk4kYMUnwFfhithUsvU4 +Pd/nBUPDQkv78XGtWNf660XQSNSB8dZGa5MosNGfRtsYDlnox02hu4xMxtlXB5uc9yqK6DTvJjHg +F7nL6LQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tg3jX-00000006hQC-2v6W; Thu, 06 Feb 2025 15:24:03 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tg3gp-00000006h98-1E21 for linux-arm-kernel@lists.infradead.org; Thu, 06 Feb 2025 15:21:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 125DBA439C0; Thu, 6 Feb 2025 15:19:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B35D4C4CEDD; Thu, 6 Feb 2025 15:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738855273; bh=R18buuzsuS125/Odab8HVwhiAwt8pdMFSvfHK7BgPUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=or1/UO5XwRfczye/Xg3Gq9snuMNbD5/7D8mXMHJadtD4gAdT5tCRPNYqcWLDwAtVb NQ0kdre2iz6RvesgTbw0NYtZIWCbkZ4LIea/r7sDruoUwy4xRgC3IeT7MIWnpNrLFG ntGemeTwGuUEI/1VAJJLP0jfYj64zmMV9sVHbmXFEu2e9vHZAqj/dL/3AC1GcaCZcg lFpn0Ty1llhSJveVbEjhW75q6PkA2NnqHkSsWwHzN3V+GEJlFn8TH+l+rtE9fpexRk CO9ail4A1mn6LfqTp+DbzcwTtHWRVzidv1M2oGPmV0aBG0tUwZs9oAHVij9HnSD8T1 Q2Sgka8EvM1hQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tg3gk-001Axu-JW; Thu, 06 Feb 2025 15:21:11 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Alexander Potapenko , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH 2/3] KVM: arm64: vgic: Check for unallocated PPI/SPI arrays Date: Thu, 6 Feb 2025 15:20:59 +0000 Message-Id: <20250206152100.1107909-3-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250206152100.1107909-1-maz@kernel.org> References: <20250206152100.1107909-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, glider@google.com, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250206_072115_394138_3517BF16 X-CRM114-Status: GOOD ( 11.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Alexander's fuzzing has exhibited a large variety of races that all end-up with taking the address of a PPI or SPI structure while the vgic was torn down (because nuking it is only an ioctl() away, and syzkaller is amazing at finding holes). In order to preserve some sanity, always evaluate whether the array containing the PPI/SPI is allocated. Suggested-by: Alexander Potapenko Signed-off-by: Marc Zyngier Tested-by: Alexander Potapenko --- arch/arm64/kvm/vgic/vgic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c index cc8c6b9b5dd8b..f454cef59e24b 100644 --- a/arch/arm64/kvm/vgic/vgic.c +++ b/arch/arm64/kvm/vgic/vgic.c @@ -89,6 +89,8 @@ struct vgic_irq *vgic_get_irq(struct kvm *kvm, u32 intid) /* SPIs */ if (intid >= VGIC_NR_PRIVATE_IRQS && intid < (kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS)) { + if (unlikely(!kvm->arch.vgic.spis)) + return NULL; intid = array_index_nospec(intid, kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS); return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS]; } @@ -107,6 +109,8 @@ struct vgic_irq *vgic_get_vcpu_irq(struct kvm_vcpu *vcpu, u32 intid) /* SGIs and PPIs */ if (intid < VGIC_NR_PRIVATE_IRQS) { + if (unlikely(!vcpu->arch.vgic_cpu.private_irqs)) + return NULL; intid = array_index_nospec(intid, VGIC_NR_PRIVATE_IRQS); return &vcpu->arch.vgic_cpu.private_irqs[intid]; } From patchwork Thu Feb 6 15:21:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13963208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98C55C02194 for ; Thu, 6 Feb 2025 15:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IkaC0JDmp9LDpZ4draWjYw8kfSk/HVwQq5Eku/l4nTM=; b=jTADWINDVSmxnpEeV2dILfLyPx x9oEHcS1if4jfY7N5nX8bxS8daWpjfyG5DoTAPJjM20sJ9iqBgfweWHaxqlcmWkye5rFjHUH7583u HAx+qwjVoyok7doOJZVNsYdHNGJKYg8ycm9DIxlrGSmny/oyOMVFs1+TpoGP8G0T8nZFEGq9zLXG4 Bjv/W7ntkhsbyaTUwmW8hTXshLQwzQV5K0i/hRUoHC/M4cJ7aH8cFxNjxNrbQrYabzDYJPGrmPDKT zDiOANju5n0kJ1FAGkCbDFRe8HZLyArDFISpkr37XC3SjGUeUN1E1/8ldYnZa4k4fTcfBUdalA30Z mp0QJNPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tg3iC-00000006hDw-0OcP; Thu, 06 Feb 2025 15:22:40 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tg3gp-00000006h9Q-1cAZ for linux-arm-kernel@lists.infradead.org; Thu, 06 Feb 2025 15:21:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B4A0EA43998; Thu, 6 Feb 2025 15:19:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EAE2C4CEDD; Thu, 6 Feb 2025 15:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738855274; bh=FA5r9vVNn5Za/abXLyc0dZQCbgu8AwK0WPUB657F/R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtvx5bfG+YzBIuNgI8MutaU6u4MEd+a5+k0FDYQPlfyJjS/w8VfJWz/2rDBwnmhHC GTOSIQgxMTddh1inJiPR9eaU10ug3jfaiyk90/Z95UOc5kty8cnBhHAXNVXPCA1yNV BePhIjh0pabLNtOMr3NFUcDzG+qEfxk2Oxn6W16FCF1T/HNY4IfGVr3CzuCgTot6pT 5zRX+aogXO7Y9f0OkYxgnSzKRzEaggryQEKA+qhlmJbgbRxNhL965qeh9SWLix+inV lRyOS2A1bHVUr8p9/Ri3QfixSve/FTtoy7Ovfg0EYgdOnBhkFLPYxGLAA0RCPgKdac bhS9eyD6kp+Ug== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tg3gm-001Axu-0W; Thu, 06 Feb 2025 15:21:12 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Alexander Potapenko , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH 3/3] KVM: arm64: vgic: Gracefully handle resetting an unallocated interrupt Date: Thu, 6 Feb 2025 15:21:00 +0000 Message-Id: <20250206152100.1107909-4-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250206152100.1107909-1-maz@kernel.org> References: <20250206152100.1107909-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, glider@google.com, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250206_072115_491243_4A55F229 X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Playing with racing vcpu reset and vgic teardown makes it relatively easy to trigger a case where, by the time we try to reset a mapped interrupt such as a timer's, the vgic is gone and there is no interrupt to play with. Check for NULL upfront to avoid further embarassement. Reported-by: Alexander Potapenko Signed-off-by: Marc Zyngier Tested-by: Alexander Potapenko --- arch/arm64/kvm/vgic/vgic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c index f454cef59e24b..2ea6d1d1d3091 100644 --- a/arch/arm64/kvm/vgic/vgic.c +++ b/arch/arm64/kvm/vgic/vgic.c @@ -542,6 +542,9 @@ void kvm_vgic_reset_mapped_irq(struct kvm_vcpu *vcpu, u32 vintid) struct vgic_irq *irq = vgic_get_vcpu_irq(vcpu, vintid); unsigned long flags; + if (!irq) + return; + if (!irq->hw) goto out;