Skip to contentSkip to conversation

Input: synaptics-rmi4 - prevent oopses when irq arrives while the device is not bound

PATCH In review Andrew Duggan 4 participants 4 messages Nov 5, 2015 – Nov 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/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.

---
 drivers/input/rmi4/rmi_driver.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/rmi4/rmi_driver.c +3 -0
index 2fdc7e8..fe5f2f9 100644
@@ -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);
Signature · 1 line
2.1.4
Tested-by on v1 4/26
#1 lore raw
Quoted 8 lines · Andrew Duggan

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.

This should just be squashed into the offending commit.

Yours,
Linus Walleij

maintainer
#2 lore raw
In reply to Andrew Duggan
Quoted 5 lines · Andrew Duggan

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?

Quoted 24 lines
---
 drivers/input/rmi4/rmi_driver.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/rmi4/rmi_driver.c +3 -0
index 2fdc7e8..fe5f2f9 100644
@@ -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);
Signature · 1 line
2.1.4
Signature · 1 line
Dmitry
#3 lore raw
Quoted 8 lines · Dmitry Torokhov
Quoted 5 lines · Andrew Duggan

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

Quoted 28 lines
Quoted 23 lines
---
 drivers/input/rmi4/rmi_driver.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/rmi4/rmi_driver.c +3 -1
index 2fdc7e8..fe5f2f9 100644
@@ -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);
--
Quoted 2 lines

2.1.4

--
Dmitry