Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984AbcDUKJz (ORCPT ); Thu, 21 Apr 2016 06:09:55 -0400 Received: from terminus.zytor.com ([198.137.202.10]:60096 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbcDUKJy (ORCPT ); Thu, 21 Apr 2016 06:09:54 -0400 Date: Thu, 21 Apr 2016 03:09:36 -0700 From: tip-bot for Matt Redfearn Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, qsyousef@gmail.com, hpa@zytor.com, matt.redfearn@imgtec.com, mingo@kernel.org Reply-To: matt.redfearn@imgtec.com, mingo@kernel.org, tglx@linutronix.de, qsyousef@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <1461229712-13057-1-git-send-email-matt.redfearn@imgtec.com> References: <1461229712-13057-1-git-send-email-matt.redfearn@imgtec.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/urgent] genirq: Dont allow affinity mask to be updated on IPIs Git-Commit-ID: 4589f450fb285ab85f7513b6649e51ec2a820653 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1845 Lines: 47 Commit-ID: 4589f450fb285ab85f7513b6649e51ec2a820653 Gitweb: http://git.kernel.org/tip/4589f450fb285ab85f7513b6649e51ec2a820653 Author: Matt Redfearn AuthorDate: Thu, 21 Apr 2016 10:08:32 +0100 Committer: Thomas Gleixner CommitDate: Thu, 21 Apr 2016 12:05:15 +0200 genirq: Dont allow affinity mask to be updated on IPIs The IPI domain re-purposes the IRQ affinity to signify the mask of CPUs that this IPI will deliver to. This must not be modified before the IPI is destroyed again, so set the IRQ_NO_BALANCING flag to prevent the affinity being overwritten by setup_affinity(). Without this, if an IPI is reserved for a single target CPU, then allocated using __setup_irq(), the affinity is overwritten with cpu_online_mask. When ipi_destroy() is subsequently called on a multi-cpu system, it will attempt to free cpumask_weight() IRQs that were never allocated, and crash. Fixes: d17bf24e6952 ("genirq: Add a new generic IPI reservation code to irq core") Signed-off-by: Matt Redfearn Cc: linux-mips@linux-mips.org Cc: jason@lakedaemon.net Cc: marc.zyngier@arm.com Cc: ralf@linux-mips.org Cc: Qais Yousef Cc: lisa.parratt@imgtec.com Link: http://lkml.kernel.org/r/1461229712-13057-1-git-send-email-matt.redfearn@imgtec.com Signed-off-by: Thomas Gleixner --- kernel/irq/ipi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/irq/ipi.c b/kernel/irq/ipi.c index c37f34b..14777af 100644 --- a/kernel/irq/ipi.c +++ b/kernel/irq/ipi.c @@ -94,6 +94,7 @@ unsigned int irq_reserve_ipi(struct irq_domain *domain, data = irq_get_irq_data(virq + i); cpumask_copy(data->common->affinity, dest); data->common->ipi_offset = offset; + irq_set_status_flags(virq + i, IRQ_NO_BALANCING); } return virq;