From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384519; b=D37j6z3yKAhU8RJkyyZdJKdDAhMysjOM2t5nT7g17M5d8tF9NRRBc9v+xQ0w7miVFcnC Yvn+6MRIp8XsyR6cDmGsTFgNb33fA3CmcwoRfdo4dfHP7z9QF47u0GEPbeIirtJuMMhCz uA96vp7eYnM6k1IZCA6q4x79MQL+WoZOc4n+zz1EuYgb/keNBKhv5lsLjxc5qvCl4ovFn OhSDUe+e2l9ZxGu8tPjWg4Snlhcep4ftCZYtvZ8fSVmwN2HQRxSoZEjq9rniiUkd8nGej b8xlt8zoupT8QKUVPIEtGUUGIiBZdsmng94dYNty29eIO92Rp1LAt9DJhlDMBnrbjwA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384519; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=CTbmxCIAY1voK2krrAQ9T3C1hWUijVwogdb4ubNHpGk=; b=v24Xkb/OL6fS3z/qgWU1E8vyvKhVFN2za0KxEGFDhn6BB07CdLs0/lVgPfZeGTcLxtT9 I5gbliWFzU0uYSXbjizOwJD9XO7D3tBgyc5omnAViD4F24GWmrTQdy/RdSNLPIBnZWYTI nXU3GOqPMkeIlfHnfvRnobJQvRnOnewWF8lM59K0PgLQd6SEX/rinJZBXWkFyRl04aB35 +taFadjppYYTEx3gQxaBMII6shruC/ODNWxfm7HaqpVHmMV/8zGHnDrBrz41oO32lAY6a liy4FAK5J4lPPqlpcU6ShgpfUoH8LXy06cBfuOeOAXPMjSNRjcR+N7df2T4iv9iTdnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="Qy0/DmCb"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC788606A682; Fri, 4 Dec 2026 11:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Qy0/DmCb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56AA21F00931; Fri, 4 Dec 2026 11:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384519; bh=CTbmxCIAY1voK2krrAQ9T3C1hWUijVwogdb4ubNHpGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Qy0/DmCbDVrnQd6U25HkoMjveDPTOzHW39DXWaFDolxGKSUmCFLDzjzOc9mp3+H2I pJCRc1vhGA2rfPPBmuYxZ7jIaA5urEx+yl0NrI1h0tjARiZD04eCSUdgla7XKJLyAA yM+JupvwoEvrXO5HxQ3Ht6q5xJWH3lPC1uu3+R7E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Florian Fainelli , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 6.6 0184/1167] MIPS: SB1250: Validate and update IRQ affinity Date: Fri, 4 Dec 2026 18:53:31 +0900 Message-ID: <20261204100706.860878439@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit 456c965ca46c59a4a241c755e6565fd883a522f4 ] sb1250_set_affinity() selects the first online CPU in the requested affinity mask without checking whether such a CPU exists. If the intersection is empty, the resulting CPU index is invalid and must not be passed to cpu_logical_map(). Reject affinity masks containing no online CPU with -EINVAL before accessing the CPU mapping or interrupt mapper registers. Also update the effective affinity mask to reflect the single logical CPU selected as the interrupt target. Fixes: 421d1563c662 ("mips: Validate online cpus in irq_set_affinity() callbacks") Signed-off-by: Florian Fainelli Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/sibyte/sb1250/irq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c index 2f08ad267a11e..d7a656cd7ec0c 100644 --- a/arch/mips/sibyte/sb1250/irq.c +++ b/arch/mips/sibyte/sb1250/irq.c @@ -76,6 +76,8 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask, unsigned long flags; i = cpumask_first_and(mask, cpu_online_mask); + if (i >= nr_cpu_ids) + return -EINVAL; /* Convert logical CPU to physical CPU */ cpu = cpu_logical_map(i); @@ -103,6 +105,7 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask, ____raw_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) + R_IMR_INTERRUPT_MASK)); } + irq_data_update_effective_affinity(d, cpumask_of(i)); raw_spin_unlock_irqrestore(&sb1250_imr_lock, flags); return 0; -- 2.53.0