Commit 4fe7ffb7 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Ingo Molnar

genirq: Fix null pointer reference in irq_set_affinity_hint()

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: e2e64a93 ("genirq: Set initial affinity in irq_set_affinity_hint()")
Reported-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
CC: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/20150128185739.9689.84588.stgit@jbrandeb-cp2.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent fb7e7deb
...@@ -244,7 +244,8 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) ...@@ -244,7 +244,8 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
desc->affinity_hint = m; desc->affinity_hint = m;
irq_put_desc_unlock(desc, flags); irq_put_desc_unlock(desc, flags);
/* set the initial affinity to prevent every interrupt being on CPU0 */ /* 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; return 0;
} }
EXPORT_SYMBOL_GPL(irq_set_affinity_hint); EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment