lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y/iefavPQ95lkzDe@hovoldconsulting.com>
Date:   Fri, 24 Feb 2023 12:24:45 +0100
From:   Johan Hovold <johan@...nel.org>
To:     Juergen Gross <jgross@...e.com>
Cc:     linux-kernel@...r.kernel.org, johan+linaro@...nel.org,
        Marc Zyngier <maz@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] irqdomain: fix regression for Xen guests

On Thu, Feb 23, 2023 at 09:38:00AM +0100, Juergen Gross wrote:
> The recent switch to per-domain locking caused a NULL dereference in
> irq_domain_create_hierarchy(), as Xen code is calling
> msi_create_irq_domain() with a NULL parent pointer.

This was unexpected. Apparently the Intel VMD driver also does this (see
vmd_enable_domain()).

> Fix that by testing parent to be set before dereferencing it. For a
> non-existing parent the irq-domain's root will stay to point to
> itself.

An alternative could be to have msi_create_irq_domain() handle the
no-parent case explicitly, but this looks the right fix for now (e.g. as
irq_domain_create_tree() does not take a flag parameter).

> Fixes: 9dbb8e3452ab ("irqdomain: Switch to per-domain locking")
> Signed-off-by: Juergen Gross <jgross@...e.com>
> ---
>  kernel/irq/irqdomain.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index aa5b7eeeceb8..6522dfb2e49c 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -1172,7 +1172,8 @@ struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent,
>  		domain = __irq_domain_create(fwnode, 0, ~0, 0, ops, host_data);
>  
>  	if (domain) {
> -		domain->root = parent->root;
> +		if (parent)
> +			domain->root = parent->root;
>  		domain->parent = parent;
>  		domain->flags |= flags;

Reviewed-by: Johan Hovold <johan+linaro@...nel.org>

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ