aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Tissoires <[email protected]>2017-03-10 10:10:54 -0800
committerDmitry Torokhov <[email protected]>2017-03-10 10:22:53 -0800
commitb6573da139ecbee6f2c77392b51266d4521d50ac (patch)
treedf161bc74a23fc597b942f26160fb0157770d315
parent45838660e34d90db8d4f7cbc8fd66e8aff79f4fe (diff)
Input: synaptics-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. Signed-off-by: Benjamin Tissoires <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
-rw-r--r--drivers/input/rmi4/rmi_f30.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c
index 3422464af229..b8572b342dcb 100644
--- a/drivers/input/rmi4/rmi_f30.c
+++ b/drivers/input/rmi4/rmi_f30.c
@@ -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);