Input: synaptics-rmi4 - prevent null pointer dereference in f30
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Fri, 10 Mar 2017 18:10:54 +0000 (10:10 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 10 Mar 2017 18:22:53 +0000 (10:22 -0800)
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 <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/rmi4/rmi_f30.c

index 3422464af229bc578d43726d266943558fe538bf..b8572b342dcb138d0119f78e9c9f82850effd740 100644 (file)
@@ -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);