[tip:,irq/urgent] irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy()
Message ID | 167716435690.5837.7282180286659633068.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp359975wrd; Thu, 23 Feb 2023 07:04:48 -0800 (PST) X-Google-Smtp-Source: AK7set/f2Lt897PuikxBQjws0a8HD9h4XUokRceDQzQnuX3bID3W5ig41otDIk5cJQWM238dO679 X-Received: by 2002:a17:906:73d2:b0:87c:c1:111 with SMTP id n18-20020a17090673d200b0087c00c10111mr15461627ejl.4.1677164688217; Thu, 23 Feb 2023 07:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677164688; cv=none; d=google.com; s=arc-20160816; b=gXJmzby8gTbL5NUNaQepwkKxikUCe8m4JdWgg76Nky0D/Bw/JM0Fa7WOTwdfKxxDZ4 yd8btW3DQbC8mOkDbqvYeboe8OsG5vMuFsGi2Wp3Cfn7KRqLOvoqeVkReTV972p2O7BM 92VSVrTJ1FGLpXAKt6ohX7XnFYavi6CF2WhetAGyCQKNyDyGyDCt/ItL7YfCmxlI/H6n XgKbpmT/3zrJeqwc6uOBSdxq27cvdOcBTnxMgF6MX83d8765kd3Dv4B8KZqaS10PEXde y8W3nxA/dZmxxtze3WZPKIIjn1Gp3EQMqE7OtWVzHpQFX3uVYo8xaugUiMssVUO89O/f Ihfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=jCVAjuc5AQRTS8zQItFvAnUhtNEEuOXdAGorfxjb+fo=; b=ypMMxV8mPRs1+cJDmYUFCAy0LaI4yw/RhPtKCXVfl6uJL16MHdr+f7a5OYZ/Fdic5P waHDm8s5nPyIZFtH3cJIo6ZUqfWFx+WZaM1yZRPk0XDfypKogZQwh7SlRn/Ov4kdnRO0 fwrNSNLQHq3hWf8YjJz2JnD6FPaUAivj/+Mew63IEwfyVzlVJTbrMHLptGrtLPpZBwGx FdL8dP0KQpIJVMZ/TW2Qh2L+nuk8j7v1uFLugsy+VhOhX6mceyqw5b1yWLT9+JHoreE2 vMg5V5dCF7EVj8yLNgP3ojFdF7PZca4rYu0Q8WYg+NziL1i+RMCAtvm/BgH2LpIOWDZj YHXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=b7Kfw1Jk; dkim=neutral (no key) header.i=@linutronix.de header.b=ASIIlfnE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fq22-20020a1709069d9600b008b1810ef12esi20014288ejc.65.2023.02.23.07.03.53; Thu, 23 Feb 2023 07:04:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=b7Kfw1Jk; dkim=neutral (no key) header.i=@linutronix.de header.b=ASIIlfnE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234425AbjBWO7X (ORCPT <rfc822;cambridge8321@gmail.com> + 99 others); Thu, 23 Feb 2023 09:59:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234224AbjBWO7W (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Feb 2023 09:59:22 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87FB718B29; Thu, 23 Feb 2023 06:59:19 -0800 (PST) Date: Thu, 23 Feb 2023 14:59:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1677164357; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jCVAjuc5AQRTS8zQItFvAnUhtNEEuOXdAGorfxjb+fo=; b=b7Kfw1JkDVa+jKCSPSm9R32gE/tCjArAehgQ+7IH5vjaV9ELcmPMlX67y/cqOLchB+I1an W8yPqtKZByDD6zsHHDPcBKkbKn++Ckn+NMnR6cjxQM+SWh65+QdFic7ij1VnZ248uo0oIM U+w6bG6u/4DA1hGGaaVGTdxQingN9GOzJkDalicwbXTmlLcIfZSINKXRlmTfRQTQDOPSfy 2IdtqWHeImi2ZK8TafEowN/P1RaTONYOTuHFTnBVMmJCahPkLgVlI/SN4OsavNviGE954i A5eDpGrLDhQjmyVwV73DVcm1Qd2g04wzuLOk+eHqSw6s4rDou0gJr/gSkyOKIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677164357; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jCVAjuc5AQRTS8zQItFvAnUhtNEEuOXdAGorfxjb+fo=; b=ASIIlfnEaq/9k1jpFPNjl0+JsgsEA1FtmvSHoLhbokQ28vXB04wghq/FrWMzQWObUbM821 g7kewmetgRItFmCQ== From: "tip-bot2 for Juergen Gross" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy() Cc: Juergen Gross <jgross@suse.com>, Thomas Gleixner <tglx@linutronix.de>, x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20230223083800.31347-1-jgross@suse.com> References: <20230223083800.31347-1-jgross@suse.com> MIME-Version: 1.0 Message-ID: <167716435690.5837.7282180286659633068.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758634640036511125?= X-GMAIL-MSGID: =?utf-8?q?1758634640036511125?= |
Series |
[tip:,irq/urgent] irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy()
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Feb. 23, 2023, 2:59 p.m. UTC
The following commit has been merged into the irq/urgent branch of tip: Commit-ID: ad32ab9604f29827494024828f527228e84fbd2c Gitweb: https://git.kernel.org/tip/ad32ab9604f29827494024828f527228e84fbd2c Author: Juergen Gross <jgross@suse.com> AuthorDate: Thu, 23 Feb 2023 09:38:00 +01:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Thu, 23 Feb 2023 15:52:28 +01:00 irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy() 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. Fix that by testing parent to be set before dereferencing it. For a non-existing parent the irqdomain's root will stay to point to itself. Fixes: 9dbb8e3452ab ("irqdomain: Switch to per-domain locking") Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230223083800.31347-1-jgross@suse.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 aa5b7ee..6522dfb 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;