linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] powerpc/xive: Don't call cpu_online() on an invalid CPU number
@ 2017-04-10  6:29 Benjamin Herrenschmidt
  2017-04-10  6:30 ` [PATCH v2 2/3] powerpx/xive: Fix irq target selection returning out of bounds cpu# Benjamin Herrenschmidt
  2017-04-10  6:30 ` [PATCH v2 3/3] powerpc/xive: Extra sanity checks on cpu numbers Benjamin Herrenschmidt
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2017-04-10  6:29 UTC (permalink / raw)
  To: linuxppc-dev

If the interrupt didn't have a selected target yet, we could
call cpu_online() and do other cpumask tests with cpu #-1 which
would result in random outcomes.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/sysdev/xive/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 9201819..dbd0f45 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -656,7 +656,8 @@ static int xive_irq_set_affinity(struct irq_data *d,
 	/* If existing target is already in the new mask, and is
 	 * online then do nothing.
 	 */
-	if (cpu_online(xd->target) &&
+	if (xd->target != XIVE_INVALID_TARGET &&
+	    cpu_online(xd->target) &&
 	    cpumask_test_cpu(xd->target, cpumask))
 		return IRQ_SET_MASK_OK;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-10  6:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-10  6:29 [PATCH v2 1/3] powerpc/xive: Don't call cpu_online() on an invalid CPU number Benjamin Herrenschmidt
2017-04-10  6:30 ` [PATCH v2 2/3] powerpx/xive: Fix irq target selection returning out of bounds cpu# Benjamin Herrenschmidt
2017-04-10  6:30 ` [PATCH v2 3/3] powerpc/xive: Extra sanity checks on cpu numbers Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).