DivestOS/Patches/Linux_CVEs/CVE-2016-6745/ANY/0003.patch

72 lines
2.5 KiB
Diff
Raw Normal View History

From 8667cc5ed59b7a4b64d82d8014bead09bddb1f76 Mon Sep 17 00:00:00 2001
From: Andrew Chant <achant@google.com>
Date: Wed, 14 Sep 2016 19:28:37 -0700
Subject: [PATCH] input: synaptics: defer sysfs creation during init
sysfs entries are created which reference fwu->fwu_work.
defer the creation of these sysfs entries until the end of the init
function, after fwu->fwu_work has been initialized.
Change-Id: I89bdf0088f98b4513d3f3c3c95ae967584dc5171
Bug: 31252388
Signed-off-by: Andrew Chant <achant@google.com>
---
.../synaptics_dsx25/synaptics_dsx_fw_update.c | 25 ++++++++++++++--------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/input/touchscreen/synaptics_dsx25/synaptics_dsx_fw_update.c b/drivers/input/touchscreen/synaptics_dsx25/synaptics_dsx_fw_update.c
index 734baafa4cfa1..3edeaa22aa336 100755
--- a/drivers/input/touchscreen/synaptics_dsx25/synaptics_dsx_fw_update.c
+++ b/drivers/input/touchscreen/synaptics_dsx25/synaptics_dsx_fw_update.c
@@ -4131,13 +4131,20 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
fwu->do_lockdown = DO_LOCKDOWN;
fwu->initialized = true;
- retval = sysfs_create_bin_file(&rmi4_data->input_dev->dev.kobj,
+#ifdef DO_STARTUP_FW_UPDATE
+ fwu->fwu_workqueue = create_singlethread_workqueue("fwu_workqueue");
+ INIT_WORK(&fwu->fwu_work, fwu_startup_fw_update_work);
+ queue_work(fwu->fwu_workqueue,
+ &fwu->fwu_work);
+#endif
+
+ retval = sysfs_create_bin_file(&rmi4_data->input_dev->dev.kobj,
&dev_attr_data);
if (retval < 0) {
dev_err(rmi4_data->pdev->dev.parent,
"%s: Failed to create sysfs bin file\n",
__func__);
- goto exit_free_mem;
+ goto exit_destroy_work;
}
for (attr_count = 0; attr_count < ARRAY_SIZE(attrs); attr_count++) {
@@ -4152,13 +4159,6 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
}
}
-#ifdef DO_STARTUP_FW_UPDATE
- fwu->fwu_workqueue = create_singlethread_workqueue("fwu_workqueue");
- INIT_WORK(&fwu->fwu_work, fwu_startup_fw_update_work);
- queue_work(fwu->fwu_workqueue,
- &fwu->fwu_work);
-#endif
-
return 0;
exit_remove_attrs:
@@ -4169,6 +4169,13 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data)
sysfs_remove_bin_file(&rmi4_data->input_dev->dev.kobj, &dev_attr_data);
+exit_destroy_work:
+#ifdef DO_STARTUP_FW_UPDATE
+ cancel_work_sync(&fwu->fwu_work);
+ flush_workqueue(fwu->fwu_workqueue);
+ destroy_workqueue(fwu->fwu_workqueue);
+#endif
+
exit_free_mem:
kfree(fwu->image_name);