From nobody Tue Sep 29 13:18:25 2026 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4876942A170 for ; Fri, 7 Aug 2026 10:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099284; cv=none; b=S/Opf+xttcWi4mHJUwTpm1YeVLhi+F7KMHB4dwpqjIq8rhL14QbmTeTFHJch6QX9+HsYsGfjWX6S9GKiOkpgehVFF2B00cHoCQ+HOhfAexUqzIAvEkp8FB/vQqxVTeyfABf+5qDC3thpnXY7eRGknI+g+noPJLHCHQ75Va6EpbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099284; c=relaxed/simple; bh=lTX9zw8nIo79IE+8hZKxtjCT2p3ZrPIQ/UhGZtPRTYs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=grggZ1Bm0GO37RgYgrLCMWhtXoNr8vmnR8rGAr6TT+NERvzNwFjY5xjsa3IrnJ23rCUGPNpDYJSdQ2JXxC5AJmH1+U6cAD2hM/cq1NcQS/jAyEM98v+e9ru6lbuNt1J/AuQK07djqameXvZ8nKU6dcu4LAUMIC2INrRw17S4jUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Rt5EDIeh; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Rt5EDIeh" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786099280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jvgbJlPCnE4f10jQC8pND6XdEzFjAYm1Jvqvul33sH8=; b=Rt5EDIehluROemfzPDBg6ZiBdcn+BpVheCAoJsaogrL4i5iElbhfJ3tgmHN0HROQqXKspe 2jJQClzY86m/uSaw3nBKbLLLwFb/7uwTTBcG4TaRhF/Gj0yEYeRNVBnMN2fLFqvKmZ9xbZ 1DACx12gvTq59MDbrZ93hLtKL+fGrJ4= From: Fuad Tabba To: Marc Zyngier , Oliver Upton Cc: Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Will Deacon , Sascha Bischoff , Sebastian Ene , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] KVM: arm64: vgic-its: Don't dereference a NULL collection on ITT save Date: Fri, 7 Aug 2026 11:40:59 +0100 Message-Id: <20260807104102.2410744-2-fuad.tabba@linux.dev> In-Reply-To: <20260807104102.2410744-1-fuad.tabba@linux.dev> References: <20260807104102.2410744-1-fuad.tabba@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" MAPC with V=3D0 drops ite->collection but leaves the ITE on the device's ITT list, and vgic_its_save_ite() dereferences it unconditionally. A guest that issues MAPD, MAPTI and then MAPC(V=3D0) therefore oopses the host when the VMM issues KVM_DEV_ARM_ITS_SAVE_TABLES to migrate it. That sequence is UNPREDICTABLE per the architecture, but KVM already handles the resulting state in the translate, MOVI and DISCARD paths. Save a zeroed entry, which vgic_its_restore_ite() reads back as invalid. Skipping the ITE instead would leave the ITT slot holding whatever is in guest memory, and restore rejects an entry naming a collection the restored collection table does not have. Fixes: eff484e0298da ("KVM: arm64: vgic-its: ITT save and restore") Cc: stable@vger.kernel.org Signed-off-by: Fuad Tabba --- arch/arm64/kvm/vgic/vgic-its.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c index 36ab3e4929154..ed281fbf008b9 100644 --- a/arch/arm64/kvm/vgic/vgic-its.c +++ b/arch/arm64/kvm/vgic/vgic-its.c @@ -2119,6 +2119,14 @@ static int vgic_its_save_ite(struct vgic_its *its, s= truct its_device *dev, u32 next_offset; u64 val; =20 + /* + * MAPC with V=3D0 keeps the ITEs mapped but drops their collection, + * and with it the ICID. Save a zeroed entry, which the restore path + * reads back as invalid. + */ + if (!ite->collection) + return vgic_its_write_entry_lock(its, gpa, 0ULL, ite); + next_offset =3D compute_next_eventid_offset(&dev->itt_head, ite); val =3D ((u64)next_offset << KVM_ITS_ITE_NEXT_SHIFT) | ((u64)ite->irq->intid << KVM_ITS_ITE_PINTID_SHIFT) | --=20 2.39.5 From nobody Tue Sep 29 13:18:25 2026 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDCCA42DA53 for ; Fri, 7 Aug 2026 10:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099286; cv=none; b=ZYYJIRSWgbpEalMKK7pLu3nw+KRh4fZqCuP3t8YagVNVlxtaZFswBYd2sMgsDoT3h9au9Z6O9QKgBmfjAG5hc6J4C7c4HGFLzOkAAd2JcvO0A8DQyj9Lr/gVR9J73UzRiSbg5cV8+w1gaKJIvTps0EmcLR7t2hIMZc1Hky/u7vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099286; c=relaxed/simple; bh=hpcT4mmWrsVBtuIsNOiEqSW7KDRvW75gMbMetYl4Cjk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kaBljKSkl18yyQWW0C8msd2HwDZuIpd9wggwhOVnUPeB6NMLu8+YVc8ws2TkY/whX0NLobyju3/4LwQR7d4f1bqIBS2jne9TDCDkiF+G1TvJt0bTGpEm7riGpcQSiaKb3jOHYy1Ph3juFo5ELGv52+6hMHX9xbUM3JSfAJlXEQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Wtq+/WRR; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Wtq+/WRR" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786099282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQKyNwSgEBS1FdQPCr0BFf1gJZ2ngUj/l5kLW14oFV0=; b=Wtq+/WRRi/zWxjokWMWgph4XGTpP8G+/C6SbMsAxCylqKbM1bC3IA/Eeqsia7zfqs2owWV wNilawhsI6w/KNzH57TCNK6r0UjGjMehcMgDmNaFgvx7zFuX/Lz4+KKePzwJ7YkkXn7j6J YoK1Lk+t4XnPRIz6KWtAbely2w+dXhs= From: Fuad Tabba To: Marc Zyngier , Oliver Upton Cc: Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Will Deacon , Sascha Bischoff , Sebastian Ene , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] KVM: arm64: vgic: Don't leak the SPI array when init is retried Date: Fri, 7 Aug 2026 11:41:00 +0100 Message-Id: <20260807104102.2410744-3-fuad.tabba@linux.dev> In-Reply-To: <20260807104102.2410744-1-fuad.tabba@linux.dev> References: <20260807104102.2410744-1-fuad.tabba@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Nothing latches a failed vgic_init(), so userspace can retry KVM_DEV_ARM_VGIC_CTRL_INIT after a failure past kvm_vgic_dist_init(). kvm_vgic_setup_default_irq_routing() is the reachable case, running on every configuration. Each retry overwrites dist->spis and only the last allocation is freed at teardown, leaking up to 960 struct vgic_irq, about 90KB, per attempt. Return early when the array is already allocated, as vgic_allocate_private_irqs_locked() and vgic_v4_init() do. Fixes: ad275b8bb1e65 ("KVM: arm/arm64: vgic-new: vgic_init: implement vgic_= init") Signed-off-by: Fuad Tabba --- arch/arm64/kvm/vgic/vgic-init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-ini= t.c index 907057881b26a..d4cf143f3ae6b 100644 --- a/arch/arm64/kvm/vgic/vgic-init.c +++ b/arch/arm64/kvm/vgic/vgic-init.c @@ -210,6 +210,9 @@ static int kvm_vgic_dist_init(struct kvm *kvm, unsigned= int nr_spis) struct kvm_vcpu *vcpu0 =3D kvm_get_vcpu(kvm, 0); int i; =20 + if (dist->spis) + return 0; + dist->active_spis =3D (atomic_t)ATOMIC_INIT(0); dist->spis =3D kzalloc_objs(struct vgic_irq, nr_spis, GFP_KERNEL_ACCOUNT); if (!dist->spis) --=20 2.39.5 From nobody Tue Sep 29 13:18:25 2026 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D58A137923 for ; Fri, 7 Aug 2026 10:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099291; cv=none; b=Ij9NN4QVR8TIzWDNGBMEf+28RfzgWIZ0IdUhNC6hDeuZYT5c/inthS+DB4vWL+a2ngAtCSUDY3GFgD4P+1e8xvv0OJNKrD69cTmWCpwseB453wYXDxov2qcgDUTLfrREVOA+7N0zTJ/FSwGqgnPJrWcwB3oY8bzT7D6EiYhXJ64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099291; c=relaxed/simple; bh=dooZ2Nsw+1ffRigL9s2oct8rGMhsJ7urG/uzFCCcWZQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H7xfegf09rslLu3+Sj5+4Ys+8H8jm2+xL98CRXJkBgXpw8Zbxtqc4QU1jnp5KdYr6HsF13HXupAPmE8F7yUZZTqAFsQhO+YoQM+Vthl2dlTV+o+DMkNKiCM4hky8syEKYDdBxZbnMWtAdwsn6HdYU+Bhe3CpjW0k37l9yJt3sK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=iauK43Lz; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="iauK43Lz" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786099285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3nr/a0dOZRkxfGZoRpT42C6sSO2flc3qcvSm9XbBZls=; b=iauK43LzFFEk438JMee7/pnVbCao2fOGE8Vj+GrWkJP5A0Ql9PLgc5IyAoOuBVwggvJdfA HVK7SqW89K8YcqJ26dFijI5Skizch3Z4iPLVIbhsp+0ddDrZN/lCmQ6/Eiqzujyjlblo/n 9SxEuIcr5p0Fpn0X/UMATxCraq0ZnUU= From: Fuad Tabba To: Marc Zyngier , Oliver Upton Cc: Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Will Deacon , Sascha Bischoff , Sebastian Ene , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] KVM: arm64: vgic-its: Don't save collections the table cannot hold Date: Fri, 7 Aug 2026 11:41:01 +0100 Message-Id: <20260807104102.2410744-4-fuad.tabba@linux.dev> In-Reply-To: <20260807104102.2410744-1-fuad.tabba@linux.dev> References: <20260807104102.2410744-1-fuad.tabba@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" A guest that disables the ITS and rewrites GITS_BASER with fewer pages, VALID still set, keeps every collection it mapped against the larger table: KVM stores the new BASER unconditionally and frees the list only when VALID is cleared. vgic_its_save_collection_table() then walks the whole list, writing up to 448K past the end of the table, and saves collection IDs that vgic_its_restore_cte() rejects, so the save succeeds and the restore fails with -EINVAL on the destination. The overrun stays in guest memory, as vgic_write_guest_lock() validates every gfn. Validate each collection against the current table with vgic_its_check_id() and return -EINVAL, as vgic_its_save_device_tables() does for devices. Collection IDs are unique and the collection table is never indirect, so the check also bounds the walk. Fixes: ea1ad53e1e31a ("KVM: arm64: vgic-its: Collection table save/restore") Signed-off-by: Fuad Tabba --- arch/arm64/kvm/vgic/vgic-its.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c index ed281fbf008b9..1589f06e66904 100644 --- a/arch/arm64/kvm/vgic/vgic-its.c +++ b/arch/arm64/kvm/vgic/vgic-its.c @@ -2540,6 +2540,9 @@ static int vgic_its_save_collection_table(struct vgic= _its *its) max_size =3D GITS_BASER_NR_PAGES(baser) * SZ_64K; =20 list_for_each_entry(collection, &its->collection_list, coll_list) { + if (!vgic_its_check_id(its, baser, collection->collection_id, NULL)) + return -EINVAL; + ret =3D vgic_its_save_cte(its, collection, gpa); if (ret) return ret; --=20 2.39.5 From nobody Tue Sep 29 13:18:26 2026 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D6BB42D753 for ; Fri, 7 Aug 2026 10:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099292; cv=none; b=Y3bzikfosWXv93Mz5x8wIztQdsPI98C2YbxlWam47u1Q+VsUBaUy4cMdWaLIVwya4CpW6kvvpaYxjM55U7UdQN4Hnb2mP55jkwzE2AnqEfYRBzkR/pPcjpv9HZ3xIocddzBUCBk/54KNKD0JHNF4/KYgYYaMcmpw5aE+nukvKE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786099292; c=relaxed/simple; bh=sBAMk3TIjuNteCkbUOcCaHOcuRV3JfadVEPYVHAwTrw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tvQrVEVXamjFtAQqAX5JNtypOyi8wjdCB4lEhLRLw5lfF6gkTHhhDD5fwgbg6p8sXgE2hKtvYBGObyheANSpkhdtVh9uQCJOFXqA5pgB7S1RC0qmIjVtuzbZYaVWcEdLxqmAlV7eZTV4EEVx87RNcXnLZvggMzR6UgUHEatuFk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=kyHH7hsL; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="kyHH7hsL" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786099287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FXAUwRKtIA0sEu908Fyzr1rasWtjR+9/qFmLbf34T8M=; b=kyHH7hsLJROPYWYpdDqxaH6UQTXc3sRl2HQttC8Q+OCWBcKB3LHKv8tx9G3nVrgLbNGkO1 MzUycBBIi52m5RAPF0d3UoQnyVoONLV2H9D5Y+5R0zq2fgDHiXrKQeCDAtipbRPQfU2CHs GVzmNRrVMC/0B422oEcoL07SZL6/x3Q= From: Fuad Tabba To: Marc Zyngier , Oliver Upton Cc: Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Will Deacon , Sascha Bischoff , Sebastian Ene , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] KVM: arm64: vgic-its: Point saved ITEs at the next valid entry Date: Fri, 7 Aug 2026 11:41:02 +0100 Message-Id: <20260807104102.2410744-5-fuad.tabba@linux.dev> In-Reply-To: <20260807104102.2410744-1-fuad.tabba@linux.dev> References: <20260807104102.2410744-1-fuad.tabba@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" An ITE whose collection was dropped is saved as an invalid entry, and vgic_its_restore_ite() has no offset to follow from one, so the scan steps a single entry at a time until it reaches a valid entry or the end of the ITT. Compute the offset to the next ITE that is saved as valid instead. Suggested-by: Oliver Upton Signed-off-by: Fuad Tabba --- arch/arm64/kvm/vgic/vgic-its.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c index 1589f06e66904..9e782a4fea7e5 100644 --- a/arch/arm64/kvm/vgic/vgic-its.c +++ b/arch/arm64/kvm/vgic/vgic-its.c @@ -2035,15 +2035,16 @@ static u32 compute_next_devid_offset(struct list_he= ad *h, =20 static u32 compute_next_eventid_offset(struct list_head *h, struct its_ite= *ite) { - struct its_ite *next; - u32 next_offset; + struct its_ite *next =3D ite; =20 - if (list_is_last(&ite->ite_list, h)) - return 0; - next =3D list_next_entry(ite, ite_list); - next_offset =3D next->event_id - ite->event_id; + /* Point at the next ITE that vgic_its_save_ite() stores as valid. */ + list_for_each_entry_continue(next, h, ite_list) { + if (next->collection) + return min_t(u32, next->event_id - ite->event_id, + VITS_ITE_MAX_EVENTID_OFFSET); + } =20 - return min_t(u32, next_offset, VITS_ITE_MAX_EVENTID_OFFSET); + return 0; } =20 /** --=20 2.39.5