Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=190c3e456325942a17785332fe15b68eeb3775ca Commit: 190c3e456325942a17785332fe15b68eeb3775ca Parent: 894be2a485b75bce9a4d45d3e431aafd4c89f1ea Author: Jeff Dike <[EMAIL PROTECTED]> AuthorDate: Sat Feb 10 01:43:55 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Sun Feb 11 10:51:21 2007 -0800
[PATCH] uml: lock the irqs_to_free list Fix (i.e. add some) the locking around the irqs_to_free list. Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> Cc: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- arch/um/drivers/chan_kern.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 4e7e3cf..bce9b34 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -222,15 +222,28 @@ void enable_chan(struct line *line) } } +/* Items are added in IRQ context, when free_irq can't be called, and + * removed in process context, when it can. + * This handles interrupt sources which disappear, and which need to + * be permanently disabled. This is discovered in IRQ context, but + * the freeing of the IRQ must be done later. + */ +static DEFINE_SPINLOCK(irqs_to_free_lock); static LIST_HEAD(irqs_to_free); void free_irqs(void) { struct chan *chan; + LIST_HEAD(list); + struct list_head *ele; + + spin_lock_irq(&irqs_to_free_lock); + list_splice_init(&irqs_to_free, &list); + INIT_LIST_HEAD(&irqs_to_free); + spin_unlock_irq(&irqs_to_free_lock); - while(!list_empty(&irqs_to_free)){ - chan = list_entry(irqs_to_free.next, struct chan, free_list); - list_del(&chan->free_list); + list_for_each(ele, &list){ + chan = list_entry(ele, struct chan, free_list); if(chan->input) free_irq(chan->line->driver->read_irq, chan); @@ -246,7 +259,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq) return; if(delay_free_irq){ + spin_lock_irq(&irqs_to_free_lock); list_add(&chan->free_list, &irqs_to_free); + spin_unlock_irq(&irqs_to_free_lock); } else { if(chan->input) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html