Skip to content

Commit

Permalink
genirq: Fix chained interrupt data ordering
Browse files Browse the repository at this point in the history
irq_set_chained_handler_and_data() sets up the chained interrupt and then
stores the handler data.

That's racy against an immediate interrupt which gets handled before the
store of the handler data happened. The handler will dereference a NULL
pointer and crash.

Cure it by storing handler data before installing the chained handler.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
  • Loading branch information
Thomas Gleixner committed May 16, 2017
1 parent 9459a04 commit 2c4569c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/irq/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,8 @@ irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
if (!desc)
return;

__irq_do_set_handler(desc, handle, 1, NULL);
desc->irq_common_data.handler_data = data;
__irq_do_set_handler(desc, handle, 1, NULL);

irq_put_desc_busunlock(desc, flags);
}
Expand Down

0 comments on commit 2c4569c

Please sign in to comment.