Skip to contentSkip to conversation

Input: rmi4 - prevent null pointer dereference in f30

PATCH Applied Benjamin Tissoires 2 participants 2 messages Mar 10, 2017

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

PATCH 1/1 Input: rmi4 - prevent null pointer dereference in f30

If the platform data has f30_data.disable set, f30 in rmi_f30_config() might be null. Prevent a kernel oops by checking for non-null f30.

---
 drivers/input/rmi4/rmi_f30.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/input/rmi4/rmi_f30.c +4 -0
index d8ff285..a0e4030 100644
@@ -170,6 +170,10 @@ static int rmi_f30_config(struct rmi_function *fn)
 				rmi_get_platform_data(fn->rmi_dev);
 	int error;
 
+	/* can happen if f30_data.disable is set */
+	if (!f30)
+		return 0;
+
 	if (pdata->f30_data.trackstick_buttons) {
 		/* Try [re-]establish link to F03. */
 		f30->f03 = rmi_find_function(fn->rmi_dev, 0x03);
Signature · 1 line
2.9.3
maintainer Applied
#1 lore raw
Quoted 4 lines · Benjamin Tissoires

If the platform data has f30_data.disable set, f30 in rmi_f30_config() might be null. Prevent a kernel oops by checking for non-null f30.

Applied, thank you.

Quoted 22 lines
---
 drivers/input/rmi4/rmi_f30.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/input/rmi4/rmi_f30.c +4 -0
index d8ff285..a0e4030 100644
@@ -170,6 +170,10 @@ static int rmi_f30_config(struct rmi_function *fn)
 				rmi_get_platform_data(fn->rmi_dev);
 	int error;
 
+	/* can happen if f30_data.disable is set */
+	if (!f30)
+		return 0;
+
 	if (pdata->f30_data.trackstick_buttons) {
 		/* Try [re-]establish link to F03. */
 		f30->f03 = rmi_find_function(fn->rmi_dev, 0x03);
Signature · 1 line
2.9.3
Signature · 1 line
Dmitry