Commit 3076212f authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: irq locking fixes

As the comment immediately preceding this points out, this list is changed in
irq context, so it needs to be protected with spin_lock_irqsave in process
context when it is processed.

Sometimes, gcc should just compile the comments and forget the code.

The IRQ side of this was better, in the sense that it blocked and unblocked
interrupts, but it still should have saved and restored them.
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 602ed87e
...@@ -236,11 +236,11 @@ void free_irqs(void) ...@@ -236,11 +236,11 @@ void free_irqs(void)
struct chan *chan; struct chan *chan;
LIST_HEAD(list); LIST_HEAD(list);
struct list_head *ele; struct list_head *ele;
unsigned long flags;
spin_lock_irq(&irqs_to_free_lock); spin_lock_irqsave(&irqs_to_free_lock, flags);
list_splice_init(&irqs_to_free, &list); list_splice_init(&irqs_to_free, &list);
INIT_LIST_HEAD(&irqs_to_free); spin_unlock_irqrestore(&irqs_to_free_lock, flags);
spin_unlock_irq(&irqs_to_free_lock);
list_for_each(ele, &list){ list_for_each(ele, &list){
chan = list_entry(ele, struct chan, free_list); chan = list_entry(ele, struct chan, free_list);
...@@ -255,13 +255,15 @@ void free_irqs(void) ...@@ -255,13 +255,15 @@ void free_irqs(void)
static void close_one_chan(struct chan *chan, int delay_free_irq) static void close_one_chan(struct chan *chan, int delay_free_irq)
{ {
unsigned long flags;
if(!chan->opened) if(!chan->opened)
return; return;
if(delay_free_irq){ if(delay_free_irq){
spin_lock_irq(&irqs_to_free_lock); spin_lock_irqsave(&irqs_to_free_lock, flags);
list_add(&chan->free_list, &irqs_to_free); list_add(&chan->free_list, &irqs_to_free);
spin_unlock_irq(&irqs_to_free_lock); spin_unlock_irqrestore(&irqs_to_free_lock, flags);
} }
else { else {
if(chan->input) if(chan->input)
......
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