[PATCH v2] irqchip/gic-v3-its: Fix double free on error

Marc Zyngier maz at kernel.org
Thu Apr 11 06:00:53 PDT 2024


On Thu, 11 Apr 2024 12:58:05 +0100,
Guanrui Huang <guanrui.huang at linux.alibaba.com> wrote:
> 
> if (vm != domain->host_data)
> 
> This is just a safety check. It looks unlikely happened.

It's not a safety check. It is just papering over problems. If you
don't trust the vm pointer, why do you trust the domain pointer? Why
do you trust *anything* at all?

> After all, vm is obtained from the args. If the caller has a bug,
> can we check here to avoid possible problems that may arise in later
> code?

If the caller has a bug, please fix the caller. Don't paper over it.

And you can remove the BUG_ON(!vm) which is equally useless.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list