linux-hardened/kernel/irq
Thomas Gleixner 4673247562 genirq: Deal with desc->set_type() changing desc->chip
The set_type() function can change the chip implementation when the
trigger mode changes. That might result in using an non-initialized
irq chip when called from __setup_irq() or when called via
set_irq_type() on an already enabled irq. 

The set_irq_type() function should not be called on an enabled irq,
but because we forgot to put a check into it, we have a bunch of users
which grew the habit of doing that and it never blew up as the
function is serialized via desc->lock against all users of desc->chip
and they never hit the non-initialized irq chip issue.

The easy fix for the __setup_irq() issue would be to move the
irq_chip_set_defaults(desc->chip) call after the trigger setting to
make sure that a chip change is covered.

But as we have already users, which do the type setting after
request_irq(), the safe fix for now is to call irq_chip_set_defaults()
from __irq_set_trigger() when desc->set_type() changed the irq chip.

It needs a deeper analysis whether we should refuse to change the chip
on an already enabled irq, but that'd be a large scale change to fix
all the existing users. So that's neither stable nor 2.6.35 material.

Reported-by: Esben Haabendal <eha@doredevelopment.dk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: stable@kernel.org
2010-06-09 17:05:08 +02:00
..
autoprobe.c genirq: Convert irq_desc.lock to raw_spinlock 2009-12-14 23:55:33 +01:00
chip.c Merge branch 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-26 15:09:06 -07:00
devres.c devres/irq: Fix devm_irq_match comment 2010-02-11 16:01:02 +01:00
handle.c genirq: Run irq handlers with interrupts disabled 2010-04-13 16:36:40 +02:00
internals.h sparseirq: Change irq_desc_ptrs to static 2010-02-17 17:27:03 -08:00
Makefile x86/irq: use move_irq_desc() in create_irq_nr() 2009-05-01 19:01:12 +02:00
manage.c genirq: Deal with desc->set_type() changing desc->chip 2010-06-09 17:05:08 +02:00
migration.c genirq: Convert irq_desc.lock to raw_spinlock 2009-12-14 23:55:33 +01:00
numa_migrate.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pm.c genirq: Convert irq_desc.lock to raw_spinlock 2009-12-14 23:55:33 +01:00
proc.c genirq: Clear CPU mask in affinity_hint when none is provided 2010-05-12 11:23:34 +02:00
resend.c irq: Remove superfluous NULL pointer check in check_irq_resend() 2009-08-09 12:44:29 +02:00
spurious.c genirq: Convert irq_desc.lock to raw_spinlock 2009-12-14 23:55:33 +01:00