Re: [PATCH v2 2/4] KVM: arm64: vgic: Don't leak the SPI array when init is retried

Marc Zyngier <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,dev.linux.lists.kvmarm
Message-ID <[email protected]>
On Tue, 18 Aug 2026 14:22:09 +0100,
Fuad Tabba <[email protected]> wrote:
> 
> Hi again Marc,
> 
> On Mon, 17 Aug 2026 at 19:40, Fuad Tabba <[email protected]> wrote:
> ...
> > > I really don't want to have to think about the intermediate state.
> >
> > Agreed. I'll drop the idempotent version I sketched and do teardown
> > and reinit instead.
> 
> Here are my thoughts. Three patches, all fixes.
> 
> vgic_init() will undo what it created when it fails, so
> KVM_DEV_ARM_VGIC_CTRL_INIT is all or nothing and a retry starts from
> scratch. Same thing you asked Karl for on the redistributor rollback
> [1].
> 
> That drops the count check I sketched. vgic_v4_init()'s early return
> stays, since vgic_its_create() still calls it for an ITS created after
> init.
> 
> irq-gic-v4.c goes first, as two patches. It removes the domains and
> frees the fwnodes without clearing the pointers, at four sites, and
> the teardown above makes that reachable on a path where it was not.
> The second is a leak in the same error path: when
> its_alloc_vcpu_sgis() fails partway, the SGI domains already allocated
> below it are never unwound.
> 
> What do you think?

Hard to picture when described like this. Please post the patches!

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.