i2c-eg20t: fix race between i2c init and interrupt enable
authorYadi.hu <yadi.hu@windriver.com>
Sun, 18 Sep 2016 10:52:31 +0000 (18:52 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:01:42 +0000 (01:01 +0000)
commit25a0d70d6162a76eebfbff33acd5746d99c32c4e
treea7204bb6e3f6f487f6727f863ef32c3e254c4811
parent1b54ab03b31e165d9af54b82d5dc1cdca26d6e7b
i2c-eg20t: fix race between i2c init and interrupt enable

commit 371a015344b6e270e7e3632107d9554ec6d27a6b upstream.

the eg20t driver call request_irq() function before the pch_base_address,
base address of i2c controller's register, is assigned an effective value.

there is one possible scenario that an interrupt which isn't inside eg20t
arrives immediately after request_irq() is executed when i2c controller
shares an interrupt number with others. since the interrupt handler
pch_i2c_handler() has already active as shared action, it will be called
and read its own register to determine if this interrupt is from itself.

At that moment, since base address of i2c registers is not remapped
in kernel space yet,so the INT handler will access an illegal address
and then a error occurs.

Signed-off-by: Yadi.hu <yadi.hu@windriver.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/i2c/busses/i2c-eg20t.c