genirq/affinity: Don't return with empty affinity masks on error
authorThomas Gleixner <tglx@linutronix.de>
Wed, 4 Apr 2018 10:40:07 +0000 (12:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jan 2019 09:01:02 +0000 (10:01 +0100)
commit76369ed5bce3b31de6c21ebf216d01fd9c9d3476
treeb7e49b2ad262161d7e54426b90fc3a8aa3344e7f
parent0840feb396aa78cdcac7f9b30f7678b68e22fddb
genirq/affinity: Don't return with empty affinity masks on error

commit 0211e12dd0a5385ecffd3557bc570dbad7fcf245 upstream.

When the allocation of node_to_possible_cpumask fails, then
irq_create_affinity_masks() returns with a pointer to the empty affinity
masks array, which will cause malfunction.

Reorder the allocations so the masks array allocation comes last and every
failure path returns NULL.

Fixes: 9a0ef98e186d ("genirq/affinity: Assign vectors to all present CPUs")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Mihai Carabas <mihai.carabas@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/irq/affinity.c