From: Thomas Gleixner Date: Thu, 11 May 2017 11:54:11 +0000 (+0200) Subject: genirq: Fix chained interrupt data ordering X-Git-Tag: C0P2-H0.0--20200415~8904 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=423f1752a0283b3f54f175be893f610f51b3aaf5;p=linux.git genirq: Fix chained interrupt data ordering commit 2c4569ca26986d18243f282dd727da27e9adae4c upstream. 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 Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index be3c34e4f2ac..077c87f40f4d 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -877,8 +877,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); }