Commit f5fe7f06 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] i8042 free_irq() aliasing fix

The same address `i8042_request_irq_cookie' is used in three places for the
i8042 request_irq() argument.  This means that if someone calls
i8042_check_mux() or i8042_check_aux() while the IRQ is in use, the
free_irq() call in there will free the wrong IRQ handler.

So give all three instances of request_irq() in i8042.c a distinct address by
which to identify the IRQ instance.

(This is probably a non-bug, because the `check' functions are not called
when the device is open, but it is better this way).
parent 188f11a1
...@@ -582,6 +582,7 @@ void i8042_controller_cleanup(void) ...@@ -582,6 +582,7 @@ void i8042_controller_cleanup(void)
static int __init i8042_check_mux(struct i8042_values *values) static int __init i8042_check_mux(struct i8042_values *values)
{ {
unsigned char param; unsigned char param;
static int i8042_check_mux_cookie;
int i; int i;
/* /*
...@@ -589,9 +590,9 @@ static int __init i8042_check_mux(struct i8042_values *values) ...@@ -589,9 +590,9 @@ static int __init i8042_check_mux(struct i8042_values *values)
*/ */
if (request_irq(values->irq, i8042_interrupt, SA_SHIRQ, if (request_irq(values->irq, i8042_interrupt, SA_SHIRQ,
"i8042", i8042_request_irq_cookie)) "i8042", &i8042_check_mux_cookie))
return -1; return -1;
free_irq(values->irq, i8042_request_irq_cookie); free_irq(values->irq, &i8042_check_mux_cookie);
/* /*
* Get rid of bytes in the queue. * Get rid of bytes in the queue.
...@@ -654,6 +655,7 @@ static int __init i8042_check_mux(struct i8042_values *values) ...@@ -654,6 +655,7 @@ static int __init i8042_check_mux(struct i8042_values *values)
static int __init i8042_check_aux(struct i8042_values *values) static int __init i8042_check_aux(struct i8042_values *values)
{ {
unsigned char param; unsigned char param;
static int i8042_check_aux_cookie;
/* /*
* Check if AUX irq is available. If it isn't, then there is no point * Check if AUX irq is available. If it isn't, then there is no point
...@@ -661,9 +663,9 @@ static int __init i8042_check_aux(struct i8042_values *values) ...@@ -661,9 +663,9 @@ static int __init i8042_check_aux(struct i8042_values *values)
*/ */
if (request_irq(values->irq, i8042_interrupt, SA_SHIRQ, if (request_irq(values->irq, i8042_interrupt, SA_SHIRQ,
"i8042", i8042_request_irq_cookie)) "i8042", &i8042_check_aux_cookie))
return -1; return -1;
free_irq(values->irq, i8042_request_irq_cookie); free_irq(values->irq, &i8042_check_aux_cookie);
/* /*
* Get rid of bytes in the queue. * Get rid of bytes in the queue.
......
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