Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2242784imm; Mon, 28 May 2018 04:37:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKe8ml+oYrGMUuSgt8josjwPBhbkhyv/iv47w0zXL4rJsVxraEBELWWu6xYNJ/VP5TUwADT X-Received: by 2002:a62:d8c1:: with SMTP id e184-v6mr8863668pfg.161.1527507473770; Mon, 28 May 2018 04:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527507473; cv=none; d=google.com; s=arc-20160816; b=esiEXA9TD76YDDOkxvtVw2CwC44DKfRQsCjDpqIy6TEYOVA9m2Z9ldR27H0rObmxg4 vHonCZLW2u8pJydfshMze0qy5sUkLKbwtT/qmkJTo0DsaR15qjH3OoCL7J62hPsb7O7G tKc35LqRElRpDi+tDow7W6qTMNfpUnd0iYCpVICZ8gL2eo09H9NSMu7NWZxbmE5OIzxz qVxt/fGReWgJSTZKOqWOLP+dBIu7GOgKbtrwXTljMlUlMaR3pHI6Ol00dQcjs4kzzUwP 7IsiBVfSAataNXVroiaADPaKdk0XS6igKJYvfoIqoNwvL+lVsL1oy4UYnKpQgpbJINV7 YXAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=LhKurtSnwjPpXz781uCCrukj5WpVnUQapyHwl86jMqE=; b=lIuniyK/SgAByuM5h8OX+DT8fwE+5IjvveNB8WABUW3GEXR9TQpizyVtv2WZgAhCxC d0Evxx+wa0RmbTxTYfuxL76helysenPBxcTFSsOIKrbnOEbcrEdFad8lzJAazkb6DcRP 1gAroloQjXYyBd7Z89JT619sm/Xxzk0s0xUsgA4gMg7XwQ4ZFlaS9g4t/UwnvwVaiNE6 K1TjDVJStQOZDDefncCm9oz4gG+BFT+DKBUmK/+a35ZjgkDV8PumfPHYlUxhrzO7auDo EH3Nq+ImuuJh92nKJMaLrxMrtqjT23q6Q1lG4tZEdegE6KaHVS3VD8ymm+RVpEvgqkOv Amvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j4oK5kOB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22-v6si7129849pfg.62.2018.05.28.04.37.34; Mon, 28 May 2018 04:37:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j4oK5kOB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424342AbeE1Lgq (ORCPT + 99 others); Mon, 28 May 2018 07:36:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:60682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938020AbeE1LNA (ORCPT ); Mon, 28 May 2018 07:13:00 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A8B23208A1; Mon, 28 May 2018 11:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527505980; bh=8X4HKPMkg9fCxAtfn8STnrYXoS3fPQYsF7tc3jk5nCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4oK5kOB1+cFTDrDHFdV3iGI240tJPKAhieWhu0M9Ax4HU0z3YHsFKGFGb5gHA488 h07Jpyx7CoPP2AtWHe2v0TRHQoqJtRoCsMKuDgm74UXv47tGgFdkfAs028EcD45uh6 jNT6aYQ7GjOn/u37ue7Xgpn9R98B87w+YhRQi0t0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Gorinov , Thomas Gleixner , Mark Rutland , Rob Herring , Sasha Levin Subject: [PATCH 4.16 198/272] x86/devicetree: Fix device IRQ settings in DT Date: Mon, 28 May 2018 12:03:51 +0200 Message-Id: <20180528100257.221525194@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100240.256525891@linuxfoundation.org> References: <20180528100240.256525891@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ivan Gorinov [ Upstream commit 0a5169add90e43ab45ab1ba34223b8583fcaf675 ] IRQ parameters for the SoC devices connected directly to I/O APIC lines (without PCI IRQ routing) may be specified in the Device Tree. Called from DT IRQ parser, irq_create_fwspec_mapping() calls irq_domain_alloc_irqs() with a pointer to irq_fwspec structure as @arg. But x86-specific DT IRQ allocation code casts @arg to of_phandle_args structure pointer and crashes trying to read the IRQ parameters. The function was not converted when the mapping descriptor was changed to irq_fwspec in the generic irqdomain code. Fixes: 11e4438ee330 ("irqdomain: Introduce a firmware-specific IRQ specifier structure") Signed-off-by: Ivan Gorinov Signed-off-by: Thomas Gleixner Cc: Mark Rutland Cc: Rob Herring Link: https://lkml.kernel.org/r/a234dee27ea60ce76141872da0d6bdb378b2a9ee.1520450752.git.ivan.gorinov@intel.com Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/devicetree.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -195,19 +195,22 @@ static struct of_ioapic_type of_ioapic_t static int dt_irqdomain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *arg) { - struct of_phandle_args *irq_data = (void *)arg; + struct irq_fwspec *fwspec = (struct irq_fwspec *)arg; struct of_ioapic_type *it; struct irq_alloc_info tmp; + int type_index; - if (WARN_ON(irq_data->args_count < 2)) + if (WARN_ON(fwspec->param_count < 2)) return -EINVAL; - if (irq_data->args[1] >= ARRAY_SIZE(of_ioapic_type)) + + type_index = fwspec->param[1]; + if (type_index >= ARRAY_SIZE(of_ioapic_type)) return -EINVAL; - it = &of_ioapic_type[irq_data->args[1]]; + it = &of_ioapic_type[type_index]; ioapic_set_alloc_attr(&tmp, NUMA_NO_NODE, it->trigger, it->polarity); tmp.ioapic_id = mpc_ioapic_id(mp_irqdomain_ioapic_idx(domain)); - tmp.ioapic_pin = irq_data->args[0]; + tmp.ioapic_pin = fwspec->param[0]; return mp_irqdomain_alloc(domain, virq, nr_irqs, &tmp); }