From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 352F6C433B4 for ; Wed, 12 May 2021 11:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E45AF61263 for ; Wed, 12 May 2021 11:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbhELLMk (ORCPT ); Wed, 12 May 2021 07:12:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbhELLMk (ORCPT ); Wed, 12 May 2021 07:12:40 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F26460720; Wed, 12 May 2021 11:11:32 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lgmm1-000so4-U6; Wed, 12 May 2021 12:11:30 +0100 Date: Wed, 12 May 2021 12:11:29 +0100 Message-ID: <87k0o4nr4u.wl-maz@kernel.org> From: Marc Zyngier To: eric.auger@redhat.com, Cc: Stable@vger.kernel.org, gshan@redhat.com, Subject: Re: FAILED: patch "[PATCH] KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read" failed to apply to 4.19-stable tree In-Reply-To: <162081638318160@kroah.com> References: <162081638318160@kroah.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, gregkh@linuxfoundation.org, Stable@vger.kernel.org, gshan@redhat.com, stable@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, 12 May 2021 11:46:23 +0100, wrote: > > > The patch below does not apply to the 4.19-stable tree. > If someone wants it applied there, or to any other stable or longterm > tree, then please email the backport, including the original git commit > id to . > > thanks, > > greg k-h > > ------------------ original commit in Linus's tree ------------------ > > From 94ac0835391efc1a30feda6fc908913ec012951e Mon Sep 17 00:00:00 2001 > From: Eric Auger > Date: Mon, 12 Apr 2021 17:00:34 +0200 > Subject: [PATCH] KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read > > When reading the base address of the a REDIST region > through KVM_VGIC_V3_ADDR_TYPE_REDIST we expect the > redistributor region list to be populated with a single > element. > > However list_first_entry() expects the list to be non empty. > Instead we should use list_first_entry_or_null which effectively > returns NULL if the list is empty. > > Fixes: dbd9733ab674 ("KVM: arm/arm64: Replace the single rdist region by a list") > Cc: # v4.18+ > Signed-off-by: Eric Auger > Reported-by: Gavin Shan > Signed-off-by: Marc Zyngier > Link: https://lore.kernel.org/r/20210412150034.29185-1-eric.auger@redhat.com > > diff --git a/arch/arm64/kvm/vgic/vgic-kvm-device.c b/arch/arm64/kvm/vgic/vgic-kvm-device.c > index 2f66cf247282..7740995de982 100644 > --- a/arch/arm64/kvm/vgic/vgic-kvm-device.c > +++ b/arch/arm64/kvm/vgic/vgic-kvm-device.c > @@ -87,8 +87,8 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write) > r = vgic_v3_set_redist_base(kvm, 0, *addr, 0); > goto out; > } > - rdreg = list_first_entry(&vgic->rd_regions, > - struct vgic_redist_region, list); > + rdreg = list_first_entry_or_null(&vgic->rd_regions, > + struct vgic_redist_region, list); > if (!rdreg) > addr_ptr = &undef_value; > else Eric, any chance you could look at a potential backport of this patch to both 4.19 and 5.4? Thanks a lot, M. -- Without deviation from the norm, progress is not possible.