2015-11-05 23:37:37

by Andrew Duggan

[permalink] [raw]
Subject: [PATCH 04/26] Input: synaptics-rmi4 - prevent oopses when irq arrives while the device is not bound

From: Benjamin Tissoires <[email protected]>

If the device has been registered but is not populated, we should not
process any incoming interrupt.
Make sure the pointers we are following are valid.

Signed-off-by: Benjamin Tissoires <[email protected]>
Tested-by: Andrew Duggan <[email protected]>
---
drivers/input/rmi4/rmi_driver.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 2fdc7e8..fe5f2f9 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -279,6 +279,9 @@ int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
struct rmi_function *entry;
int error;

+ if (!data || !data->f01_container || !data->irq_status)
+ return 0;
+
error = rmi_read_block(rmi_dev,
data->f01_container->fd.data_base_addr + 1,
data->irq_status, data->num_of_irq_regs);
--
2.1.4


2015-11-09 12:59:04

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 04/26] Input: synaptics-rmi4 - prevent oopses when irq arrives while the device is not bound

On Fri, Nov 6, 2015 at 12:37 AM, Andrew Duggan <[email protected]> wrote:

> From: Benjamin Tissoires <[email protected]>
>
> If the device has been registered but is not populated, we should not
> process any incoming interrupt.
> Make sure the pointers we are following are valid.
>
> Signed-off-by: Benjamin Tissoires <[email protected]>
> Tested-by: Andrew Duggan <[email protected]>

Tested-by: Linus Walleij <[email protected]>

This should just be squashed into the offending commit.

Yours,
Linus Walleij

2015-11-09 23:16:15

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 04/26] Input: synaptics-rmi4 - prevent oopses when irq arrives while the device is not bound

On Thu, Nov 05, 2015 at 03:37:25PM -0800, Andrew Duggan wrote:
> From: Benjamin Tissoires <[email protected]>
>
> If the device has been registered but is not populated, we should not
> process any incoming interrupt.
> Make sure the pointers we are following are valid.

Why are the interrupts enabled when device is not ready?

>
> Signed-off-by: Benjamin Tissoires <[email protected]>
> Tested-by: Andrew Duggan <[email protected]>
> ---
> drivers/input/rmi4/rmi_driver.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> index 2fdc7e8..fe5f2f9 100644
> --- a/drivers/input/rmi4/rmi_driver.c
> +++ b/drivers/input/rmi4/rmi_driver.c
> @@ -279,6 +279,9 @@ int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
> struct rmi_function *entry;
> int error;
>
> + if (!data || !data->f01_container || !data->irq_status)
> + return 0;
> +
> error = rmi_read_block(rmi_dev,
> data->f01_container->fd.data_base_addr + 1,
> data->irq_status, data->num_of_irq_regs);
> --
> 2.1.4
>

--
Dmitry

2015-11-10 09:12:02

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH 04/26] Input: synaptics-rmi4 - prevent oopses when irq arrives while the device is not bound

On Tue, Nov 10, 2015 at 12:16 AM, Dmitry Torokhov
<[email protected]> wrote:
> On Thu, Nov 05, 2015 at 03:37:25PM -0800, Andrew Duggan wrote:
>> From: Benjamin Tissoires <[email protected]>
>>
>> If the device has been registered but is not populated, we should not
>> process any incoming interrupt.
>> Make sure the pointers we are following are valid.
>
> Why are the interrupts enabled when device is not ready?

Hmm... Yes, maybe this should have been tackled at the smbus level.
Sorting this out might also help in the various suspend/resume bugs we
are experiencing.

Cheers,
Benjamin

>
>>
>> Signed-off-by: Benjamin Tissoires <[email protected]>
>> Tested-by: Andrew Duggan <[email protected]>
>> ---
>> drivers/input/rmi4/rmi_driver.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
>> index 2fdc7e8..fe5f2f9 100644
>> --- a/drivers/input/rmi4/rmi_driver.c
>> +++ b/drivers/input/rmi4/rmi_driver.c
>> @@ -279,6 +279,9 @@ int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
>> struct rmi_function *entry;
>> int error;
>>
>> + if (!data || !data->f01_container || !data->irq_status)
>> + return 0;
>> +
>> error = rmi_read_block(rmi_dev,
>> data->f01_container->fd.data_base_addr + 1,
>> data->irq_status, data->num_of_irq_regs);
>> --
>> 2.1.4
>>
>
> --
> Dmitry