genirq: Fix null pointer reference in irq_set_affinity_hint()
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Wed, 28 Jan 2015 18:57:39 +0000 (10:57 -0800)
committerIngo Molnar <mingo@kernel.org>
Mon, 9 Feb 2015 17:47:42 +0000 (18:47 +0100)
The recent set_affinity commit by me introduced some null
pointer dereferences on driver unload, because some drivers
call this function with a NULL argument. This fixes the issue
by just checking for null before setting the affinity mask.

Fixes: e2e64a932556 ("genirq: Set initial affinity in irq_set_affinity_hint()")
Reported-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/20150128185739.9689.84588.stgit@jbrandeb-cp2.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/irq/manage.c

index f038e586a4b9f5a51317481dd1a3956ca4b5580e..196a06fbc122fed81333c3bfd7205cfcef9aa73f 100644 (file)
@@ -244,7 +244,8 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
        desc->affinity_hint = m;
        irq_put_desc_unlock(desc, flags);
        /* set the initial affinity to prevent every interrupt being on CPU0 */
-       __irq_set_affinity(irq, m, false);
+       if (m)
+               __irq_set_affinity(irq, m, false);
        return 0;
 }
 EXPORT_SYMBOL_GPL(irq_set_affinity_hint);